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.

Member Avatar for iamthwee

You you not put the other fields in ONE div then just write the code to show or hide it?

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.

Member Avatar for iamthwee

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.

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.

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.

Member Avatar for iamthwee

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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.