<分区>
标签 javascript jquery html css
<分区>
在 CSS 中有很多属性选择器,比如
a[href$=mp3] { // this means that if there is a <a> and it has href attribute and the href ends-with mp3 then apply my style
.... my style
}
如果我想在 JQuery 中做这样的事情怎么办
$("a[href$=mp3]").click(function ()) {
alert("An audio link is clicked !!");
});
但它在第一行给我一个错误/异常
Uncaught SyntaxError: Unexpected token )
任何人都可以修复它或给我一个变通办法吗??
最佳答案
第一行的最后一个 )
不应该存在。这导致了语法错误。
$("a[href$=mp3]").click(function ()) {
// ^ remove
关于javascript - JQuery 中的 CSS 属性选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28315810/