internet explorer 9 - Add Class to parent, jquery and IE9 -
so simple, can't work in ie9. ive read tons of answers , nothing seems work. need add class elements parent, seems simple right? in other browsers, trick:
$('#trigger').click(function(e){ e.preventdefault(); $(this).parent().addclass('bar'); });
not in ie9. solutions ive found don't work either:
$('#trigger').click(function(e) { e.preventdefault(); var item = $(this).closest("li"); $(item).addclass('bar'); });
this working in ie9
$('#trigger').click(function(e) { e.preventdefault(); var item =$(this).parent('li'); $(item).addclass('bar'); });
<ul> <li class="foo"> <a href="javascript:void(0)" id="trigger">click me</a> </li> <li>other shit</li> </ul>
Comments
Post a Comment