开发者

jquery text search

开发者 https://www.devze.com 2023-02-27 00:34 出处:网络
I have HTML. <body> <span> <font=\"color\"> adfadf 23423423423 ORDER_NUMBER: </font>

I have HTML.

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

M123456JK98766 is 开发者_运维技巧14 digit number. Need to check only 14 digit character.

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.

I have no option to add id against M123456JK98766.


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

test it here : http://jsfiddle.net/GmENT/4/


There are JS functions such as match() and search()but you will still need to be retrieving a chunk of text from an element before you can even do that.

0

精彩评论

暂无评论...
验证码 换一张
取 消