Introduction:
Here I will explain how to split the string using split function in JQuery with asp.net.
Here I will explain how to split the string using split function in JQuery with asp.net.
Description:
In previous posts I explained many articles relating to JQuery. Now I will explain how to split the string using split function in JQuery.
In previous posts I explained many articles relating to JQuery. Now I will explain how to split the string using split function in JQuery.
To
split the string we have function called Split() in JQuery by using that we can
split string based on our specific character that would like as shown below
<script type="text/javascript">
$(document).ready(function()
{
$('#btnSplit').click(function() {
var name = $('#txtName').val();
var arr = name.split('@');
var sampletxt = '';
for (var i = 0; i <
arr.length; i++) {
alert(arr[i]);
}
})
});
</script>
|
If
you observe above script I used special character '@' to split string. If
you want check this code in sample check below code
Example:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1"
runat="server">
<title>Split the string using Split function in JQuery</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$('#btnSplit').click(function() {
var name = $('#txtName').val();
var arr = name.split('@');
var sampletxt = '';
for (var i = 0; i <
arr.length; i++) {
alert(arr[i]);
}
})
});
</script>
</head>
<body>
<form id="form1"
runat="server">
<table>
<tr><td align="right"><b>Enter Text:</b></td>
<td><asp:TextBox ID="txtName"
runat="server"
Text="Aspdotnet@Suresh@Dasari"/></td>
</tr>
<tr><td align="right"></td>
<td><asp:Button ID="btnSplit"
runat="server"
Text="Split
Text" /></td>
</tr>
</table>
</form>
</body>
</html>
|
Demo
To check demo click
on button
|
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
9 comments :
nice
thanks....,
awesome...
I am using Visual Web Developer 2008 on Windows XP. I downloaded the toolkit from asp.net website. I created a new tab called Ajax Control Toolkit in the toolbox and added the extenders in that tab. Everything works fine and dandy. But when I close Visual Web Developer and reopen it, the control toolkit is gone and I have to add it again. How can I add it permanently or am I doing something wrong?
@Comment 4..
Check this article
http://www.aspdotnet-suresh.com/2011/11/how-to-install-ajax-control-toolkit-in.html
Hello sir thanks for your reply, i did the same whatever u have in your article but when i close the Visual Studio and open it again the TOOLBOX does not shows AJAX controls which we have added, i want to retain it permanently when i open the IDE every-time.
Your articles are really very nice anyone can be easily understand, could you please write an article about how to use Facade, design patterns Factory methods abstract class in 3 tier architecture. Please sir.
how to relationship parent to child in data table in c# asp.net
Thank you for giving this topic with good example so that i can understand easily and I will use in my project also.
Note: Only a member of this blog may post a comment.