我正在为jQuery使用this plugin。
该插件尝试创建一个具有value=属性的锚(<a>)标记。但是,它不会在我的浏览器中创建具有任何此类属性的标签。这是jQuery问题吗?或者是HTML问题?我不知道为什么它似乎对这么多人有效,但对我不起作用。
下面是我使用的代码:
$("<a/>").prop({
className: "ui-rating-star ui-rating-empty",
title: $(this).text(), // perserve the option text as a title.
value: this.value // perserve the value.
}).appendTo(elm);这将创建以下元素:
<a class="ui-rating-star ui-rating-empty" title="1 Star"></a>我使用的是jQuery v1.9.1,如果这很重要的话。
发布于 2013-05-04 06:11:34
.prop只设置属性,而不设置属性。如果创建了一个属性,则浏览器不会执行jQuery操作。
http://api.jquery.com/prop/
https://stackoverflow.com/questions/16368269
复制相似问题