Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cheerio selector for first nested html element

This Meteor server side code is trying to get the amount 77 which is in this html string but my selector is returning empty object. How can I get 77 out of this html? Thanks

$('select[name=paid] option').data();
<td class="displayValue">

            <select name="paid" id="paidId"><option value="77.00" selected="selected">77.00</option>


              <option value="Other">Other</option></select>

      </td>
    </tr>
like image 331
Fred J. Avatar asked May 23 '16 19:05

Fred J.


1 Answers

$('select[name=paid] option').first().attr('value')

Should work! Your code is too general and won't return anything because there is more than one option.

like image 51
Christopher Reid Avatar answered Sep 22 '22 10:09

Christopher Reid