jQuery Return elements where ID begins with a certain string
-
23-08-2019 - |
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?
Solution
Use attribute selectors
$(document).ready(function(){
$("span[id^='val_']").hide();
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow