<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-3.1.1.min.js"></script>
<script type="text/javascript">
function maxtxt() {
debugger;
var text =
document.getElementById("txt").value;
var text1 = text.split(" ");
document.getElementById("TextBox1").value = text1.length;
if (text1.length > 5) {
var text11 = text.slice(0, -1);
document.getElementById("txt").value = text11;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox runat="server" ID="txt" onkeyup="maxtxt();"></asp:TextBox>
<br />
<asp:TextBox runat="server" ID="TextBox1"></asp:TextBox>
</div>
</form>
</body>
</html>
No comments:
Post a Comment