1 (edited by Tharpe5 2019-08-09 06:28:16)

Topic: Previewing users text with jquery

I want to achieve the functionality that this editor has got with its preview feature tellsubway.

I have got this html:

    <textarea id="tbMsg" style="height:450px;width:100%;"></textarea>
I want whatever is in the textarea above to go onto this div, every 2 secs or so.

      <DIV id="preview" style="BORDER-RIGHT: #c0c0c0 1px solid; PADDING-RIGHT: 3px;
    BORDER-TOP: #c0c0c0 1px solid; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; BORDER-LEFT: #c0c0c0 1px solid; WIDTH: 660px;
    PADDING-TOP: 3px; BORDER-BOTTOM: #c0c0c0 1px solid; HEIGHT: 700px"></DIV>
I have this javascript/jquery:

    <script type="text/javascript">
   $(function() {
    $('#tbMsg').keyup( function() {
        alert(1);
        var text = $(this).val();
        $('#preview').html(text);
    });
});
    </script>
Alert 1 never happens, which means that the request wasnt successful. Where does my jquery goes wrong?

Re: Previewing users text with jquery

Grab the opportunity that could win you free coupons and gift cards. additionally, One Grand prize of $1000 and Ten first prizes of $100 every month in cheques are awarded to lucky winners. participate now onwecare.riteaid.com survey.
https://legendofozzy.com/wecare-riteaid-com/

Re: Previewing users text with jquery

Thanks for sharing such a helpful instruction, really appreciate for your article.


MyBalanceNow

4 (edited by barrykaauamo 2022-09-06 05:12:45)

Re: Previewing users text with jquery

This is my first time on the site - really happy to find this support group. I have personally struggled with internet addiction issues and look forward to exploring the resources here. BayCare Patient Portal Pay Bill

5 (edited by robersa 2022-09-13 04:00:48)

Re: Previewing users text with jquery

I recommend you a wonderful site reports that will help you write any written work.
ACAeronet Login Page

Re: Previewing users text with jquery

When the user types something in the input field, the keyup event is triggered and the function inside the on() method is executed. We then use the val() method to get the value of the input text and assign it to the text variable. Finally, we use the text() method to update the content of the #preview element with the text variable.

This way, as the user types in the input field, the #preview element will update in real-time with the user's text.



Ball Sports Games