第一个嵌套 html 元素的 cheerio 选择器
cheerio selector for first nested html element
此 Meteor 服务器端代码试图获取此 html 字符串中的数量 77,但我的选择器返回空对象。我怎样才能从这个 html 中得到 77?谢谢
$('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>
$('select[name=paid] option').first().attr('value')
应该可以!您的代码过于笼统,不会 return 任何东西,因为有多个选项。
此 Meteor 服务器端代码试图获取此 html 字符串中的数量 77,但我的选择器返回空对象。我怎样才能从这个 html 中得到 77?谢谢
$('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>
$('select[name=paid] option').first().attr('value')
应该可以!您的代码过于笼统,不会 return 任何东西,因为有多个选项。