Question

I have a lot of <span> tags like this <span id='val_Title'></span> <span id='val_Name'></span>

I would like to return all the elements that begin with 'val_' and hide them.

How can I do this?

Was it helpful?

Solution

Use attribute selectors

$(document).ready(function(){
   $("span[id^='val_']").hide();
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top