SIVA

SIVA

  • NA
  • 742
  • 700.3k

I need to change the ID of textbox at runtime.. How ?

Jan 27 2012 6:56 AM

Dear All,

This is my code


<script type="text/javascript" language="javascript">



var _CountJK = 0;

function btnAddJK_onclick() {

String _txtID="txtJK"+_CountJK;


var d = document.getElementById("divJK");

d.innerHTML += "<p><textarea id=_txtID name='_txtID' cols='40' rows='2' style='width:100px;height:30px;' ></textarea></p>";

_CountJK++;

}

</script>


my intension is i need to create textbox at runtime..
Here,
When i create new textbox that ID of the textbox needs to change.
thats what i created variable _CountJK & i incremented that.
so when i user clicks add button again that count has to be increase & it has to assign to its ID
Its not coming 
Can anybody give idea how to do this.. 

Answers (3)