It is best for the code to explain the question.
代码最好解释一下这个问题。
<s:iterator value="collection" status="stat">
...
<input
id="sendEmailButton${stat.count}"
value="<s:text name="label.send.email"/>"
type="button"
data-action="sendEmail"/>
...
</s:iterator>
...
<script>
...
$(function(){
$('#sendEmailButton').unbind('click');
...
});
</script>
How to get that particular button in jquery?
如何在jquery中获取该特定按钮?
2 个解决方案
#1
1
Try attribute starts with selector
..
尝试使用选择器启动属性..
$('[id^="sendEmailButton"]')
#2
0
The starts with selector works just fine. If you want another alternative you can select by your data-action attribute:
选择器的启动工作得很好。如果您想要其他替代方案,可以通过data-action属性进行选择:
$('input[data-action=sendEmail]')
#1
1
Try attribute starts with selector
..
尝试使用选择器启动属性..
$('[id^="sendEmailButton"]')
#2
0
The starts with selector works just fine. If you want another alternative you can select by your data-action attribute:
选择器的启动工作得很好。如果您想要其他替代方案,可以通过data-action属性进行选择:
$('input[data-action=sendEmail]')