Jquery <tr> and id elements
Hi I am new to Jquery and wondered i开发者_运维知识库f I can give a an ID and if so how can I then get the value back . The best I have come up with so for is
rid = $('tr').attr('id').val()
but no luck ......
thanks
No need for the .val(), just use this:
var rid = $('tr').attr('id');
.attr('attributeName') returns a string (in most cases) of the attribute, .val() is for getting the value from input type elements (<input>, <select>, <textarea>, etc).
To set the value:
$('tr').attr('id', 'someValue');
To get the value:
var id = $('tr').attr('id');
加载中,请稍侯......
精彩评论