locked
how to show typing alert in label RRS feed

  • Question

  • User-807418713 posted

    Hello

    I have one textbox if user type it should user is typing...

    thanking you

    Wednesday, July 29, 2020 8:12 AM

Answers

All replies

  • User-2121988648 posted

    Use keypress event in Javascript/jQuery.. Please let me know if you need sample code :)

    Wednesday, July 29, 2020 9:19 AM
  • User-807418713 posted

    hello

    please give me code

    thank you

    Wednesday, July 29, 2020 9:39 AM
  • User-2121988648 posted

    Please refer to this..

    HTML Code:
    
    <form>
    <fieldset>
    <input id="target" type="text" >
    </fieldset>
    </form>
    <div id="msg"></div>
    
    JQuery Code:
    $( "#target" ).keypress(function() {
    $("#msg").html("Typing..");
    });
    
    Javascript Code:
    
    document.getElementById("target").onkeypress = function() {myFunction()};
    
    function myFunction() {
      document.getElementById("msg").innerHTML = "Typing..";
    }
    
    

    Wednesday, July 29, 2020 9:43 AM
  • User-807418713 posted

    hello

    here is my code its not working


    <script type="text/javascript">

    document.getElementById('<%=TextBox1.ClientID %>').onkeypress = function() {myFunction()};

    function myFunction() {
    document.getElementById("msg").innerHTML = "Typing..";
    }

    </script>

    <meta http-equiv="refresh" content="600" />
    </head>
    <body onload="openWindow()" oncopy="return false;" onpaste="return false;" oncut="return false;">
    <form id="form1" runat="server" >
    <div>
    <div id="msg"></div>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <strong>Enter </strong>
    <asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True" OnTextChanged="TextBox2_TextChanged"
    Width="94px" BorderColor="Red" BorderStyle="Solid" BorderWidth="1px"></asp:TextBox>
    <asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Names="Palatino Linotype" Font-Size="11pt" ForeColor="Teal"></asp:Label>
    <asp:updatepanel id="UpdatePanel1" runat="server">
    <contenttemplate>

    just an example i have posted here

    Wednesday, July 29, 2020 9:58 AM
  • User-2121988648 posted

    Please check the generated id using inspect element.

    Also, add this 

    document.getElementById("demo").onkeyup = function() {myFunction2()};
    
    function myFunction2() {
    document.getElementById("msg").innerHTML = "";
    }

    Wednesday, July 29, 2020 10:34 AM
  • User-807418713 posted
    Hello

    Let me explain you in clear

    Two user open Website and chatting each other

    If user type in textbox it should to other user typing... Same like facebook or what's app chat...

    How to do so...

    Thanking You
    Thursday, July 30, 2020 6:31 AM
  • User-2121988648 posted

    For this purpose you need to setup socket communication. you must checkout SignalR Hub,

    https://docs.microsoft.com/en-us/aspnet/core/tutorials/signalr?view=aspnetcore-3.1&tabs=visual-studio

    Thursday, July 30, 2020 7:27 AM
  • User-807418713 posted

    Hello

    Im using Old verison of asp.net not core

    thanking you

    Friday, July 31, 2020 11:20 AM
  • User-943250815 posted

    SignalR was created before .Net Core, you can get it on Nuget.
    There are many Chat samples out there, just search for.
    Here is one https://www.c-sharpcorner.com/UploadFile/78d182/signalr-sample-chat-application-in-C-Sharp/

    This does not answer your question, but SignalR can be a better choice for your need

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, July 31, 2020 11:55 AM
  • User-2121988648 posted

    Create a user identity with used for login --> Create a signal hub --> Send from hub to clients --> Client with active identity will receive the message --> Vice versa flow will also work. 

    You can also deploy it to Azure.

    Friday, July 31, 2020 12:20 PM