首页javascriptattributejQuery Selector - 如何按属性值选择锚链接

jQuery Selector - 如何按属性值选择锚链接

我们想知道如何按属性值选择锚链接。

<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
  src='http://code.jquery.com/jquery-1.4.2.js'></script>
<script type='text/javascript'>
$(window).load(function(){
    $('a[action|=open]').live('click', function(evt) {
        console.log('test');
    });
});
</script>
</head>
<body>
  <a href="#" action="open">Link 1</a>
  <a href="">no action</a>
</body>
</html>