jquery text search
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.
精彩评论