I need to find the id div that starts with a chart using a wildcard:
So, given the following DOM
<div id="box5" class="box-container"> <div class="inner-box wide"> <div class="top-box handle">Some content</div> <div class="chart"><div id="chart1_div">A chart</div></div> </div> </div>
My guess was.
var $elementToFind = $("[id^=chart]"); var found = $('div#box5').find($elementToFind).attr('id'); alert(found);
But it doesn't seem to work.
Thanks for the help,
source share