I have 3 controls with id control_1
, control_2
, control_3
.
I want to hide these controls.
Currently I am using this:
Why not replacing IDs with a class like .controls
? Then just use:
$(".controls").hide();
You could use:
$('#control_1,#control_2,#control3').hide();
or use attributeStartsWith
For completeness, you can use the starts with attribute filter:
$('[id^="control_"]').hide();
That said, for most purposes it would be better to go with one of the other suggestions.
Instead, you can set same class to your controls and hide them like that :
$('.controlClass').hide();