hi, i want to have a button wherein it will create dynamic text boxes depending on the times i click the button. i've seen several codes thru javascript, however, i cannot get the value of the said textbox,

could you please help me with this?? tnx..^^

Recommended Answers

All 7 Replies

U can simply get the value of the checkbox if u use jquery.

if The text box is <input type="text" name="example" id="example">

Then u can take the value of that text box in js page by this simple code.

var textname = $("input#example").val();

enjoy coding.

hi, i want to have a button wherein it will create dynamic text boxes depending on the times i click the button. i've seen several codes thru javascript, however, i cannot get the value of the said textbox,

could you please help me with this?? tnx..^^

hi,xuexue
where is your code?

i always use this function to get any value
<input type="text" name="example" id="example" value="">

<script type="javascript">
function getValue()
{
   var txtValue = document.getElementById("example").value;
   return
}
</script>

this button display your value after clicked
<input type="button" onClick="getValue()">

hopefully you're clear

yeah it is the solution for you problem. thanks for sharing this with us.

hi, i want to have a button wherein it will create dynamic text boxes depending on the times i click the button. i've seen several codes thru javascript, however, i cannot get the value of the said textbox,

could you please help me with this?? tnx..^^

I thinking you looking to create the textboxes onclick of some button,
something like below can help you to get started -

<input type='button' value='Add new ' onclick='AddRow()'>
function AddRow() {
    var table = document.getElementById( 'insertorder' );
    var tbody = table.getElementsByTagName( 'TBODY' )[ 0 ];
    var numRows = tbody.rows.length;
	if(numRows >12)return false;
    var where   = tbody.rows[ numRows - 1 ];
    var newRow  = emptyRow.cloneNode( true );
	for(var i=0; i<tbody.rows.length; i++)
	{
		var new_name = "l2pn";
		for(var j=0; j<tbody.rows[i].childNodes.length; j++)
		{
			alert(">>"+tbody.rows[i].childNodes[j].getAttribute("Name")+">>");
			//tbody.rows[i].childNodes[j].setAttribute('name',new_name);
    	}	

    }
	insertAfter( where, newRow, numRows );
  }

well, guys, thanks for your help.
hmm, could you give me the whole code itself?
i mean from the moment you create the dynamic text box up to the value getting of the created text box?

thanks a lot..^^

well, guys, thanks for your help.
hmm, could you give me the whole code itself?
i mean from the moment you create the dynamic text box up to the value getting of the created text box?

thanks a lot..^^

try to change the code on your own ,according to your need; post the errors here, if you stuck up somewhere

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.