I need to find the id of a div that starts with chart using 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 doesn’t seem to work.
Thanks for the help,
should work.