html5 - how to hide tags using jQuery? -


**<!doctype html> <html lang="en"> <head>   <title>welcome wall street model</title>   <meta charset="utf-8">   <meta name="viewport" content="width=device-width, initial-scale=1">   <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">   <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#c").click(function(){     $("h1").hide(); }); </script>  </head>    <button id="c">click hide</button>  <h1>this message</h1> </body> </html>** 

i new jquery. tried code hide h1 tags when button clicked.but not working.

when writing code need make sure all syntax correct:

$(document).ready(function(){     $("#c").click(function(){         $("h1").hide(); }); 

here forgot });. should be:

$(document).ready(function(){     $("#c").click(function(){         $("h1").hide();     }); }); 

you javascript won't work because when browser runs one problem stop executing javascript.

jsbin


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -