0

Hello,

I have found lots of examples on how to display a form field onclick, but none if I want to display an entire form onclick of a button. I am having difficulty figuring out where to put the form along with all of its form fields, in the head script area or in the body. Do I absolutely need another div here?

Thanks in advance for any assistance you might be able to provide.

4
Contributors
8
Replies
10
Views
5 Years
Discussion Span
Last Post by aspirina
0

So the best way is to put all of the form fields within a div and then show/hide that div? Would you be able to help me with where the form actually goes, in the head or body? Thanks for your help.

0

The form or html goes in the body.

You have a css style sheet defining said forms dimensions, styling and positions.

Your Jquery is normally executed at the bottom of the bottom as I understand is the standard now.

I can help I guess, post what you have already, including the html and .css file, and jquery.

0

jQuery may be an overkill for this... you can do this with a simple JavaScript function. the function can either go in the head or if you place it in the body, it needs to go after the div.

0

I don't have th js function yet, that is part of what I'm trying to determine how to do as I am pretty new to js yet.

<div id="">
<form action="insert.php" method="post">
a: <input type="text" name="a" />
b: <input type="text" name="b" />
<input type="submit" /></form>
</div>

What I'd like to do is hide this div until an image is onclick, and then make it visible, and then return to hidden onclick.

Edited by jckb188

0

You could do it with just javascript I guess, but I wouldn't say it was an overkill.

Size doesn't really matter because chances are another web page will have used google's jquery and should be cached. IMO the Jquery framework is worth a bigger download size in the long run and far outweighs using just javascript.

Now for this you would reference the onclick for the picture and then use .hide() method.

Good tutorials IMO is:

http://www.youtube.com/watch?v=GNb8T5NBdQg

If you want I could post up an example on jsfiddle.

Edited by iamthwee

0

Size doesn't really matter because chances are another web page will have used google's jquery and should be cached.

very true...good point.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.