Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

http://jquery.com


Children Display


The below is an example to hide Example 1) Hide all the content in <p> tag based in jQuery.

Code Block
languagexml
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
  $("p").click(function(){
    $(this).hide();
  });
});
</script>
</head>
<body>

<p>If you click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>

</body>
</html>


Example 2) Call a URL, and show its response

Code Block
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
var fd = new FormData();    
fd.append( 'file', input.files[0] );

jQuery.ajax({
  url: 'http://example.com/script.php',
  type: 'POST',
  data: fd,
  processData: false,
  contentType: false,
  async: false,
  success: function(response){
    alert(response);
  }
});
</script>