I want after click on button append value hello 2 in tag td with class name subpage and append value hello 3 in class name tdadeps wit find it class in html code that is in var obj and in end append var obj whit values in .wfnish tbody, it doesn’t work in my try, how can fix it?
DEMO: http://jsfiddle.net/yxKFX/1/
My try:
$('button').live('click', function (e) {
e.preventDefault();
$('.wfnish').show();
var obj = '<tr><td>hello 1</td><td class="subpage"></td><td class="tdadeps"></td></tr>';
$(obj, '.subpage').append('hello 2');
$(obj, '.tdadeps').append('hello 3');
$('.wfnish tbody').append(obj);
})
Just use
.find().You’ll also notice that I stored the result of passing the HTML string. This is required because the original string is never modified.
If you really want to use the second argument to the jQuery function, you have them reversed:
Under the hood, this is analyzed then reinvoked as the
.find()code above.