I have a table with the row below:
When the span field in the second td is clicked I want to change the text in the td.enPublish for the row.
What I have now is
$('span#publish_field').click (function() {
title = this.title; // this is a raw DOM span node, so we can go directly after the title attribute.
$(this).closest("tr").$('td.enPublished').text('steve');
$.post("set_publish.php", { "product_id" : title }, function(echoed_data) {
alert (echoed_data);
});
The third line is supposed to get at that field, but it doesn't. Does anyone see the problem?
The title attribute holds a product_id value for that row and is used in the ajax call to set a field in the database. I thought I could also update the field here in the HTML so the user wouldn't have to refresh the page to see it.
Thanks for any ideas.
更改$
以find
$(this).closest("tr").find('td.enPublished').text('steve');
use find()
try this
$(this).closest("tr").find('td.enPublished').text('steve');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.