How to add jQuery to your code

You can include jQuery calls anywhere in your php page. The code needs to be inside <script> tags and be called by jQuery function.

Below is a simple example of a button that will disappear after you click on it.

$html = '<button id="clickme">Click on Me</button><div class="showme" style="display:none">Some text</div>;
echo $html;


And the jQuery script below makes the text appear and the button disappear after it has been clicked.

$html = '<script>
                   jQuery(document).ready(function($) {
                    $("#clickme").click(function(){
                       $(".showme").show();
                      $("#clickme").hide();

                     });
                  });
</script>';

echo $html;