<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SplitInJavascript.aspx.cs" Inherits="SplitInJavascript" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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" /></td>
</tr>
<tr><td align="right"></td>
<td><asp:Button ID="btnSplit" runat="server" Text="Split Text" /></td>
</tr>
</table>
</form>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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" /></td>
</tr>
<tr><td align="right"></td>
<td><asp:Button ID="btnSplit" runat="server" Text="Split Text" /></td>
</tr>
</table>
</form>
</body>
</html>