我正在使用jquery,我正在循环:
$("span").each(function (index) {
var idname = $(this).attr('id');
$("#" + idname).click(function () {
window.location.href = "http://" + $(this).attr('id') + "lin.gw";
});
}); //end for click attachment to button
Run Code Online (Sandbox Code Playgroud)
我想循环id包含where的元素*raid*.它的语法是什么?
使用属性包含选择器:
$("span[id*=raid]").click(function(){
window.location.href = "http://"+ this.id +"lin.gw";
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3620 次 |
| 最近记录: |