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
Post a Comment