jquery - If a has attr rel=lightbox then addClass, problem -
i wonder why doesn't work?
var attr = $("a").attr('rel'); if (typeof attr == 'lightbox') { $(this).addclass("lightbox"); } i want add class link has rel attribute set "lightbox".
this should work... right?
$('a[rel="lightbox"]').addclass("lightbox"); that should trick.
typeof - returns data type not value! trying compare type (string) value (lightbox).
Comments
Post a Comment