Implementing Hide and Seek using jQuery.
💻 coding

Implementing Hide and Seek using jQuery.

1 min read 141 words
1 min read
ShareWhatsAppPost on X
  • 1The tutorial demonstrates how to implement Hide and Seek functionality using jQuery and PHP for a single page application.
  • 2It includes a jQuery script that toggles visibility between 'results' and 'save_form' sections based on button clicks.
  • 3The buttons for 'Add Record', 'Save', and 'Cancel' utilize a common class and their functionality is controlled through their respective IDs.

AI-generated summary · May not capture all nuances

Key Insight
AskGif

"The tutorial demonstrates how to implement Hide and Seek functionality using jQuery and PHP for a single page application."

Implementing Hide and Seek using jQuery.

This tutorial about Hide and Seek with jQuery and PHP. This script helps you to present all modules in a single page.

Here we will learn to Implement Hide and Seek functionality using jQuery.

Javascript Code

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js"></script>
<script type="text/javascript">
$(function()
{

$(".button").click(function()
{
var button_id = $(this).attr("id");

//Add Record button
if(button_id=="add")
{
$("#results").slideUp("slow");
$("#save_form").slideDown("slow");
}

//Cancel button
else if(button_id=="cancel")
{
$("#save_form").slideUp("slow");
$("#results").slideDown("slow");
}

// save button
else
{
// insert record
// more details Submit form with jQuery
}

return false;
});
});
</script>

HTML Code

Contains javascipt code. $(".button").click(function(){}- button is the class name of buttons(Add, Save and Cancel). Using $(this).attr("id") calling button id value.

<div id="results" >

<a href="#" class="button" id="add" >Add Record </a>
</div>

<div id="save_form" style="display:none" >

<a href="#" class="button" id="save" >Save </a>
<a href="#" class="button" id="cancel" >Cancel </a>
</div>

<div id="update" >

</div>

Enjoyed this article?

Share it with someone who'd find it useful.

ShareWhatsAppPost on X

AskGif

Published on 24 September 2019 · 1 min read · 141 words

Part of AskGif Blog · coding

You might also like