码迷,mamicode.com
首页 > Web开发 > 详细

jquery click & get value of attributes of a href

时间:2014-07-02 20:22:43      阅读:302      评论:0      收藏:0      [点我收藏+]

标签:http   os   cti   io   amp   jquery   

http://stackoverflow.com/questions/6625667/jquery-click-get-value-of-attributes-of-a-href

 

/* Add a listner to Group buttons */
    $(‘a.preActNav‘).click(function() { 
        alert(this.seq)
    });   



    <li><a href="#preclose4" data-theme="a" data-icon="arrow-d" data-transition="none" seq=‘1‘ class="preActNav"  ID="preActNavA">A</a></li>
    <li><a href="#preclose4" data-theme="a" data-icon="arrow-d" data-transition="none" seq=‘2‘ class="preActNav"  ID="preActNavB">B</a></li>


alert($(this).attr(‘seq‘));

Although it may be better to put seq as another data element:

<li><a href="#preclose4" data-theme="a" data-icon="arrow-d" data-transition="none" data-seq=‘1‘ class="preActNav"  ID="preActNavA">A</a></li>

So then you can do:

alert($(this).data(‘seq‘));

jquery click & get value of attributes of a href,布布扣,bubuko.com

jquery click & get value of attributes of a href

标签:http   os   cti   io   amp   jquery   

原文地址:http://www.cnblogs.com/zhxm/p/3819264.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!