本文介绍了jQuery文本搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有HTML.

<body>
    <span>
        <font="color">
          adfadf
          23423423423
          ORDER_NUMBER:
        </font>
    </span>
    <span>M123456JK98766</span>
</body>

M123456JK98766是14位数字.只需要检查14位字符.

M123456JK98766 is 14 digit number. Need to check only 14 digit character.

我想从HTML查找订单号M123456JK98766.我该如何找回呢?每次使用页面刷新都可以更改该数字.

I like to find a order number M123456JK98766 from HTML. How can I retrieve that? that number can be changed every time by using page refresh.

我没有选择针对M123456JK98766添加ID.

I have no option to add id against M123456JK98766.

推荐答案

var orderNumber = $('span:contains("ORDER_NUMBER")').next().text();

在此处进行测试: http://jsfiddle.net/GmENT/4/

这篇关于jQuery文本搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 14:00