项目后选择器jquery

时间:2017-04-10 09:50:49

标签: javascript jquery html css3

如何使用选择器选择210.00

<tr class="order-total">
  <th>Total</th>
  <td data-title="Total">
    <strong>
      <span class="woocommerce-Price-amount amount">
        <span class="woocommerce-Price-currencySymbol">$</span>
        210.00
      </span>
    </strong> 
  </td>
</tr>

3 个答案:

答案 0 :(得分:0)

只需尝试

<iron-selector attr-for-selected="name" multi selected-values='["foo","bar"]' selected-attribute="checked">

var allChildNodes = $("td[data-title='Total'] span").first()[0].childNodes;
var lastSpanNode = allChildNodes[ allChildNodes.length - 1 ];

通过

获取其价值
var allChildNodes = $("td[data-title='Total']").find("span").first()[0].childNodes;
var lastSpanNode = allChildNodes[ allChildNodes.length - 1 ];

答案 1 :(得分:0)

试试这个

var device = RestService.For<IDevice>("http://localhost");    
CancellationTokenSource tokenSource = new CancellationTokenSource();
tokenSource.CancelAfter(10000); // 10000 ms
CancellationToken token = tokenSource.Token;          
var dev = await device.GetDevice("15e2a691-06df-4741-b26e-87e1eecc6bd7", "Bearer OAUTH_TOKEN", token);

答案 2 :(得分:0)

找出210.00

的另一个小方法
var total = $('tr.order-total td[data-title="Total"]').text().replace('$', '').trim();
console.log(total);

Woring URL:https://jsfiddle.net/mb7s24pb/