views:

32

answers:

1

I need to get the value of the div "code"

<ol id="selectable">
    <li>
      <div id="img01" style:"background-image: url(…);">
      <div id="name01">Frekad</div> 
      <div id="code01">3234427APW</div>
    </li>
     <li>
      <div id="img02" style:"background-image: url(…);">
      <div id="name02">Rosswa</div>
      <div id="code02">3234423AQW</div>
    </li>
     <li>
      <div id="img03" style:"background-image: url(…);">
      <div id="name03">Jeppo</div>
      <div id="code03">3234425AQQ</div>
    </li>
</ol>

I need to get the codeXX value for each li into an array. Thanks.

+3  A: 

You can use the following loop to iterate through all the codeXX divs:

$("div[id^='code']").each(function(){
});
Fabian