jquery - Apply an effect to many IDs in a page -
i using loading effect in button (bootstrap v.3) works fine.
<a href="#" class="btn btn-primary" role="button" id="fat-btn" >read</a>
and script
$('#fat-btn').click(function () { var btn = $(this) btn.button('loading') settimeout(function () { btn.button('reset') }, 9000) });
this works fine! applied first button in page. can do, apply effect more buttons? thought type similar scripts different selectors. not convenient, (if have 20 buttons, type 20 different selectors??)
use class selector instead of id selector , assign same class buttons have.
$('.btn-primary').click(function () { var btn = $(this); btn.button('loading'); settimeout(function () { btn.button('reset'); }, 9000); });
Comments
Post a Comment