javascript - How can I combine these statements? jQuery -


i have jquery statement this;

var current = $(this); current.hide(); current.siblings('.ab').hide(); current.siblings('.cd').hide(); 

i want change single statement , wrote;

$(current,current.siblings('.ab'),current.siblings('.cd')).hide(); 

but ab not hiding. how can combine 3 hide() statements one?

thanks in advance...:)

you can use multiple selector , addback():

$(this).siblings(".ab, .cd").addback().hide(); 

addback() add original element set, can both element , relevant siblings in same jquery object.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -