Search code examples
jqueryfindchildren

jquery td content by attribute - cannot use children or find methods?


i can't figure out what should be a simple task:

http://jsfiddle.net/elen/7agUc/3/

$(document).on("change",'td[col=cat_id] select',function() {
    var v = $(this).val();
    var tr = $(this).parent().parent(); // getting parent row

    var tr_id = tr.attr('primary_key');
    var d = tr.childern('td[col=Artist').html(); // getting text in the specific cell of the same row

    alert(d);

});​

the above code throw an error - "children method is not supported"

the following works:

var d = $("tr[primary_key="+tr_id +"] td[col=Artist]").text();

but why can't i just use children() or find() :

var d = tr.find('td[col=Artist').text();

or am i missing something here?...


Solution

  • You have a typo: replace childern by children.