javascript - How to hide element using "this"? -


pardon stupidity can please explain me how can hide element using this keyword? example working:

jquery(document).ready(function($){     if($('.someclass').length==1){         $('.someclass').hide();     }   }); 

but no go me:

jquery(document).ready(function($){     if($('.someclass').length==1){         $(this).hide();     }   }); 

thank you!

do need use this (in case, see other answers) or seek avoid selector duplication? this?

jquery(document).ready(function($){   var elem = $('.someclass');   if(elem.length == 1){     elem.hide();   }   }); 

Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -