【发布时间】:2014-06-03 10:37:51
【问题描述】:
我正在尝试在通过 wordpress 插件动态生成的对象元素上附加一个 javascript 函数,并且仅使用元素名称而不是 Id 生成,我正在尝试执行以下操作:
<script type="text/javascript">
$(document).ready(function() {
$('#selector').gentleSelect(); // apply gentleSelect with default options
});
</script>
但是由于元素没有 ID 属性,只有 name 属性,我怎样才能使这个功能起作用!
我在这里尝试使用gentleselect jquery 插件!
谢谢 阿米特。
【问题讨论】:
-
$("[name='whatever']").gentleSelect()? -
我尝试了你所说的,在 chrome inspect 上我看到了错误:Uncaught TypeError: undefined is not a function on the same line。
标签: javascript jquery jquery-plugins