Amarnath R Shenoy Amarnath R Shenoy - 2 months ago 7
Javascript Question

How to select a td from a table with ID using jquery

i have a table with td's having Id, I need to select those td's with Id Please help.
My requirement is by selectng this td's i need to reorder the columns.

$('table tr').each(function () {
var tr = $(this);
var tds = $('#Status');
var tdA = $('#Address');
alert(tds.innerHtml); //Here am getting a blank msg
tds.remove().insertAfter(tda); //This is what i need to do
});

Answer
var selectedTd = $("#ID_OF_TD");

or to call the method like on click etc etc you can directly call the method

$("#ID_OF_TD").click(function(){

});

you need to put this code in document ready section ..

$("document").ready(function(){             
        $("#ID_OF_TD").click(function(){
            alert('td clicked');
        });     
});