0
<div id = "board_code">
 <div>
    <span>r</span>
    <span>o</span>
    <span>w</span>
    <span>1</span>
 </div>

 <div>
    <span>r</span>
    <span>o</span>
    <span>w</span>
    <span>2</span>
 </div>
</div>

I am trying to get the string '2' to be used for comparison with char like { [ ( < ' "

I tried this:

alert($('#board_code > div').eq(1).eq(3).text();
output is: blank

When I tried this:

alert($('#board_code > div').eq(1).eq(0).text();
output is: row2

1 Answers1

1
$("span").last().text()

That could work, but I'm not sure if it's good enough for your needs.

http://jsfiddle.net/6r2nP/1/

$("#board_code span").last().text()

That one might be better.

http://jsfiddle.net/6r2nP/2/

MortenMoulder
  • 6,138
  • 11
  • 60
  • 116