0
我尝试使用下面的代码时,得到一个选项的属性值属性:
$('#select3,#select5,#select7,#select9,#select11')
.children('option[value="'+ selectedDValue +'"]', this)
.attr({'disabled': true,'data-subtext':$(this).attr("data-subtext") + '
(postcode area saved in another zone)'});
但是$(this).attr("data-subtext")
将返回“未定义”,因此该属性是打印为data-subtext="Undefined (postcode area saved in another zone)"
。该选项有一个名为data-subtext
的属性,所以我想知道为什么没有返回?
创建拨弄链接,这样我们可以来了解确切的问题。或尝试像这样:-' $('#select3,#select5,#select7,#select9,#select11')。children('option [value =''+ selectedDValue +'“]')。each(function() {(disabled):true,'data-subtext':$(this).attr(“data-subtext”)+'(保存在另一个区域的邮编区域)'}); });' –
不幸的是仍然返回undefined @Anant,但感谢尝试 –