我已经在使用 id 和 title,但我需要再解析 2 位...
$(this).attr("title"); $(this).attr("id");
$(this).attr("custom1");
可以工作吗?
最佳答案
是的,顺便说一句,您可以一次设置多个属性:
$('.myselector').attr({
src: 'thefile.gif',
width: 200,
height: 300 });
关于javascript - jQuery attr 是否允许非标准?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5223414/