wind开发者_开发技巧ow.something.updateStatus = function(theName) {
$('#myTable').children('tr').remove(":contains('theName')");
};
Obviously the above does not work because it is looking for a string called "theName" in any in myTable.
What I'd like to do is pass in theName's Value to the contains.
How do I evaluate this expression?
Thanks.
This is untested, but should work:
window.something.updateStatus = function(theName) {
$('#myTable').children('tr').remove(":contains('" + theName +"')");
};
Essentially it removes the variable theName
from the string, but still quotes that value (once the variable's interpolated), which is why there's an opening, and closing, '
either side of the variable and +
concatenation operators.
精彩评论