Combining selectors?

后端 未结 3 1521
遥遥无期
遥遥无期 2021-01-25 11:24

I have two click events as follows:

$($(\'[id^=\"tab\"]\')).live(\'click\', function() {
    alert($(this).attr(\"id\"));
});

$($(\'[id^=\"home\"]\')).live(\'cl         


        
3条回答
  •  时光取名叫无心
    2021-01-25 12:10

    $('[id^="tab"], [id^="home"]').live('click', function() {
        alert($(this).attr("id"));
    });
    

    http://jsfiddle.net/yUYVh/3/

提交回复
热议问题