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'); }); 

here's fiddle try in ie9

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

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -