Skip to content Skip to sidebar Skip to footer

How To Set An Id With Some Value In Of Td In Javascript

i m creating td in javascript what i want is this '' how can i set the td id in javascript i use setAtteribute() not working my code look like this var cell4 = r

Solution 1:

cell5.id = 'example1'; // javascript

I suppose we're talking about IE here? I don't know about "id", but..

http://webbugtrack.blogspot.com/2007/08/bug-242-setattribute-doesnt-always-work.html

Solution 2:

Using javascript (w/o jquery)

cell4.id="some_td_id"

for example

        advTable=document.getElementById("advance_option");
        advRow = advTable.insertRow(advTable.rows.length);
        advRow.id ="tr_id"  // Here you can set tr's id
        cell0=advRow.insertCell(0);
        cell0.id="td_id"  // Here you can set td's id
    cell1=advRow.insertCell(1);

Solution 3:

cell5.attr("id","example1"); //jquery 

Post a Comment for "How To Set An Id With Some Value In Of Td In Javascript"