We are already using split function in c# server-side code, In below code is the Split function in client-side code.ASPX Page
Aspx page
- <asp:Text Box runat="server" ID="text1"></asp:Text Box>
- <asp:Text Box runat="server" ID="text2"></asp:Text Box>
- <asp:Button ID="btn" runat="server" text="reverse" onClientClick="reverse(this)"></asp:Button>
Script
- function reverse(evt1) {
- var txt = document.getelementById("text1").value;
- var n = text.split(" ");
- document.getElementById("text2").value = n[1] + " " + n[0];
- }