开发者

Select images having a specific onmouseover call using jQuery

开发者 https://www.devze.com 2023-04-13 01:14 出处:网络
I have a php code that generates a piece of html code like this. <img src=\"images/1.jpg\" onmouseover=\"funct_update(1, 10, 21)\" onclick=\"funct_click(...)\" />

I have a php code that generates a piece of html code like this.

<img src="images/1.jpg" onmouseover="funct_update(1, 10, 21)" onclick="funct_click(...)" />
<img src="images/2.jpg" onmouseover="funct_update(5, 2, 9)" onclick="funct_click(...)" />
<img src="image开发者_开发知识库s/3.jpg" onmouseover="funct_update(8, 12, 100)" onclick="funct_click(...)" />

Now since I don't want to touch the PHP code, I wonder if it is possible to select, using jQuery, all images having as attribute onmouseover="funct_update(.*)" , and bind +1 function for onmouseover event.


Take a look a James Padolsey regex filter which can be used as follows:

$("img:regex(onmouseover, funct_update.*)").mouseover(function(){
    // Your New Function Here
});

Hope this helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号