jQuery Return elements where ID begins with a certain string

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?

Use attribute selectors

$(document).ready(function(){
   $("span[id^='val_']").hide();
});


The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .
Read More:   Prevent double submission of forms in jQuery

Similar Posts