Solved make a hidden button + textbox

Microsoft / Vista
July 25, 2009 at 17:00:40
Specs: Windows Vista, 2GB
Hello I am making a webpage and I want a textbox and a submit button to appear when I different button is clicked here is the code I am using:


<script type="text/javascript">
function addInput(f,a) {
var aInputs=f.getElementsByTagName('textarea');
for(var i=0; i<aInputs.length; i++) {
if(aInputs[i].className=='hide') {

<style type="text/css">
input {display:block;}
.hide {display:none;}


<form action="#" name="form1">
<textarea id="box1" cols="75" rows="5" class="hide" type="text"
<button type="button" id="box2" class="hide"
<button type="button"


I don't know how to make the button appear, can anyone help please, or if I could make the comment button work to make the textbox appear and then make it be comment the second time it is pressed, is that possible? Or could I get the button to work to, maybe something like this:

var aInputs=f.getElementsByTagName('textarea' 'button');

I don't know, Please help, I have seen these kind of things work before on facebook and some other sites, but how?

See More: make a hidden button + textbox

Report •

July 26, 2009 at 14:13:30
You would do better to post this in the Web Development forum.

Report •

July 26, 2009 at 16:05:26
I know, but this site was being stupid and only giving me an
option of about 5 forums and they were all hardware thing
so I put it in this.

Report •

July 28, 2009 at 17:56:41
✔ Best Answer
Hey, answering your previous question from here:

jQuery is just a single javascript file that you include in a <script> tag, you can grab the latest version from here:

In jquery you can target dom elements via CSS selectors, and that's really where the beauty of it lies - you can target elements using good ole CSS.

So, the page would look something like this:
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
//fires after body loads
$(function() {
//When the id=clickme_button is pressed
$('#clickme_button').click(function() {
//Toggle visibility on the .hideme items
<style type="text/css"><!--
.hideme { display: none; }
<input type="button" id="clickme_button" value="Click me" />

<input class="hideme" type="button" value="Some value" />
<textarea class="hideme"></textarea>
<p class="hideme">All the elements with a CSS class of hideme get selected</p>

The base download can do a lot, check the documentation for examples here:

Report •

Related Solutions

July 29, 2009 at 03:27:01
Thank you so much, that may be one of the best answers I have gotten from this site, but one more thing, what if I want to or more of those kind of buttons on the same
page, I don't want the first button to control everything on the page, just some of them, is that possible?

Report •

August 10, 2009 at 18:59:01
Never mind, I figured out how to do more than one, but I uploaded my files and for some reason it doesn't work. is there a way to do it without using jQuery and using just
plain javascript? go to this site it is the code you posted up here, I put the files in the right directory but it just doesn't work.

Report •

Ask Question