each() 函数用相同的值更新所有元素
each() function updating all elements with the same value
试图让这个功能发挥作用,但它并不是真正适用于每个 .travel
。每一次旅行都有相同的结果
$(".travel").each(function() {
var land = $(".invisible .land").text();
$(".land-vorschau").html(land);
});
你能帮忙吗?
后代中的select,使用.find()
,像这样:
$('.travel').each(function(i, e) {
var land = $(e).find('.invisible .land').text();
$(e).find('.land-vorschau').html(land);
});
您必须在您的上下文中使用 $(this)
$('.travel').each(function() {
var land = $(this).find('.invisible .land').text();
$(this).find('.land-vorschau').html(land);
});
试图让这个功能发挥作用,但它并不是真正适用于每个 .travel
。每一次旅行都有相同的结果
$(".travel").each(function() {
var land = $(".invisible .land").text();
$(".land-vorschau").html(land);
});
你能帮忙吗?
后代中的select,使用.find()
,像这样:
$('.travel').each(function(i, e) {
var land = $(e).find('.invisible .land').text();
$(e).find('.land-vorschau').html(land);
});
您必须在您的上下文中使用 $(this)
$('.travel').each(function() {
var land = $(this).find('.invisible .land').text();
$(this).find('.land-vorschau').html(land);
});