I am trying to hide input elements within my form with the following code. But it is not working...
<html lang="en"> <head> <title>children demo</title> <script src="https://code.jquery.com/jquery-1.10.2.js"></script> </head> <body> <h1>Hello</h1> <div> <h1 class="selected">div-1</h1> <h1 class="selected">div-2</h1> </div> <h1>xyz</h1> <form name= "demo form"> First name:<input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> <input type="submit" value="submit"> <script> $( "div" ).children( ".selected" ).css( "background-color", "yellow" ); document.body.style.backgroundColor = "red"; $( demo_form.elements ).hide(); </script> </body> </html>
''in the jquery selector