Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

hide form using javascript, simple error

Tags:

javascript

I'm beginner with Javascript. I've tried to hide a form with no luck.

Where is the error ?

http://jsfiddle.net/6EWCe/5/

<div id="form1">    
<form>
First name: <input type="text" name="firstname"><br>
Last name: <input type="text" name="lastname">
</form>
</div>

<div id="form2">    
<form>
First name:2 <input type="text" name="firstname"><br>
Last name:2 <input type="text" name="lastname">
</form>
</div>

<a href="#" onclick="hideform()">Close</a>


function hideform() {
    document.getElementById('form2').style.display = 'none';
}
like image 457
user204415 Avatar asked May 18 '26 12:05

user204415


1 Answers

Uncaught ReferenceError: hideform is not defined

...is your error.

You need to specify that you want your JavaScript to load in the body of your JSFiddle demo using the options in the sidebar:

Example

Fixed JSFiddle demo.

like image 155
James Donnelly Avatar answered May 21 '26 01:05

James Donnelly



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!