jQuery: $(document).on(event, name as selector, function
This question already has an answer here:
Use an Atrribute Selector like this:
$("[name = 'theNameYouWant']");
More CSS Selectors here .
Note: The CSS Selectors are not exclusive features of jQuery. They work everywhere (in CSS files, using document.querySelector
...)
试试这个: $(document).on('click', '*[name="3"]', function()..
*在大多数情况下不需要。
You can do it this way.
$( "[name*='man']" ).on('click', function(){
alert("worked!!");
})
You can refer this docs for attribute selection in jQuery
https://api.jquery.com/attribute-contains-selector/
链接地址: http://www.djcxy.com/p/36260.html上一篇: 使用jquery隐藏具有名称的元素