在jQuery中获取字符串 [英] Getting piece of string in jQuery
本文介绍了在jQuery中获取字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用jQuery获得一些字符串. 例如:
I want to get some of string with jQuery. Ex:
<div class="example">
My sentence: xxxxxx
</div>
"xxxxxx"是变量. 我想在我的句子:"之后得到一个片断.我该怎么办?
EDIT :"xxxxxx" is a variable. I want to get a piece after "my sentence:". How can I do it?
推荐答案
您可以执行此操作-
var text = $('.example').text().split(':')[1];
演示----->
http://jsfiddle.net/czW9x/
这篇关于在jQuery中获取字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文