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

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -