I want to hide all elements within a div which have class name starting with ‘p’ and followed by any character.
<div id="myDiv">
<div id="p0"> .... </div>
<div id="p1"> ..... </div>
<div id="abc"> .... </div>
</div>
So I want to hide the ‘p0’ and ‘p1’ div and leave ‘abc’ div.
I am trying following code
$('#myDiv').find('#p*').hide();
But obviously this is wrong. Please suggest me how to use wild card with jQuery selector.
Let me know if more code is required.
You can use an attribute-starts-with selector:
Example is here