hi,
i need to empty all the divs whic has an id like 'bkoption'
eg : my html code is like this

<div class="subsubsubmenu" id="bkoption1">some content</div>
<div class="subsubsubmenu" id="bkoption2">some content</div>
<div class="subsubsubmenu" id="bkoption3">some content</div>

so when i trigger an on click function i need to empty all of these divs.
i wrote something like this to test before coding the rest, which didn't work , or even didn't show an error on firebug.

$('div[id*="bkoption"]').each(function(index) {
	alert(index + ': ' + $(this).text());
});

what am i doing wrong?
much appreciate reply.

If you plan to learn scripting any time soon, you should first forget about its wrappers.

var divstoclear = document.getElementsByClassName("subsubmenu"),x;
for(x in divstoclear){divstoclear[x].innerHTML="";

* using innerHTML property here because you don't want empty elements pilling.

thank you for ur reply.
wrappers? u mean id here..? please forget about the class name here... its irrelavent. i should have removed it from the code, please forget there is a class at all.
i only want to select div which has an id like 'bkoption'

<div id="bkoption1">some content</div>
<div id="bkoption2">some content</div>
<div id="bkoption3">some content</div>

hi, my function actually worked... it turn out to be that my browser has cashed data. lately my firefox is cashing too frequently. i don't know why and it's like i have to clear cashe very hour or more when i'm developing :-/

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.