I have 4 DIV’s with different ID’s (but have same prefix (testDiv[1|2|3|4]) ) and i want to set their visblity(visible or hidden) on some event.
How can i use to set the DIV visiblity property at one times something like
$('testDiv*').css('visibility', 'visible');
OR
$('testDiv*').css('visibility', 'hidden');
There is workaround to this problem. I can have a class named “.comnClass” for all the DIV’s and change its property
But i want a solution having four different DIV id.
THANKS ALL
You can use the starts with selector
^=like this:Note that if you use a class instead, you can target them easily but that depends on your requirements.