Split text using JQuery

Posted by Virendradugar under jQuery category on | Views : 67472
Below code will split text of any element using JQuery. You can download the Jquery from http://docs.jquery.com/Downloading_jQuery.

jQuery provides a method "split()", which splits the text. We can use any delimiter to split the text. I have used space to split.
<script type="text/javascript" src="Script/jquery-1.5.1.js"></script>
<script type="text/javascript">
var element = $("#lblMessage").text().split(' ');

Below is the label with ID "lblMessage", which we have used in jQuery to split the text.
<asp:Label ID="lblMessage" runat="server" Text="Dotnetfunda rocks"></asp:Label>


For detailed walk through of split function visit http://bit.ly/troMk4

Visit my blog

Comments or Responses

Posted by: Jayeshl on: 4/6/2011 Level:Starter | Status: [Member] | Points: 10
Thanks, it really helped.

I found another article which explains about jQuery split function in detail. Visit below link ..



Posted by: Phagu007 on: 7/19/2013 Level:Starter | Status: [Member] | Points: 10
Dear Virendra
It is a useful code for Split text using JQuery

Login to post response