tags:

views:

56

answers:

2

hi all, i have to acces the id of textarea in javasript.Please tell me how we can access the id of the textarea in javascript.

+1  A: 
alert(document.getElementById("urtextboxId").id);
Pandiya Chendur
Shortened: `alert("urtextboxId")` ;)
deceze
+1  A: 

If you want to access ids of all textarea in your document you can use this

var txtAreas = document.getElementsByTagName("textarea");
var len = txtAreas.length;
var ids = new Array();

for(i=0; i<len; i++)
{
    ids.push(txtAreas[i].id);    
}
rahul
"`this.id`"...?
deceze
Thanks @deceze. Fixed the typo
rahul
Too much `$.each()` I take it. ;)
deceze