Jquery find all ids starting with a string?

Just wondered how I would search for all the ids starting with "content_" in the whole page and also a way to only find them in a named div called "extra_content". Once i have all the ids i want to hide them.

Below is an example of what i want to find.

<div id="content_1"></div> <-- Find
<div id="content_2"></div> <-- Find
<div id="contet_3"></div>

<div id="extra_content"> 
    <div id="content_extra_1"></div> <-- Find
    <div id="content_extra_2"></div> < -- Find
</div>

Examples would be helpful.

Thanks

72
задан Liam 6 April 2017 в 10:59
поделиться