• Neo

    (@neocsatornaja)


    I would check, if possible Ajax, the comment form is empty.
    In the case of empty printed below the textarea red to “give me a text.”
    If successful transmission, the green enter into a textarea, the comment form below to “send successful”
    Oh, and do not want to replace any of the current one plugin, as many shell functions linked to the current form.

Viewing 3 replies - 1 through 3 (of 3 total)
  • First part’s easy enough:

    <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.3.min.js"> </script>
    <script>
    $(document).ready(function() {
    $('#userInput').focus(function() {
    $('#instructions').fadeOut();
    });
    });
    </script>
    <input id="userInput" type="textarea"></textarea>
    <div id="instructions">Give me a text</div>

    Doesn’t include color but that’s just CSS. If I understand the other part of your question, that takes a bit more coding but it’s still pretty basic. Try googling “jquery ajax callback” and you’ll see lots of examples.

    Thread Starter Neo

    (@neocsatornaja)

    This not realy working me:S
    Here my printscreen

    It’s very simple…i’ll give you some step just follow those & you will get what you want,

    Step 1) : Create your HTML same as you screenshot. like,
    <form>
    <textarea name=”txt” class=”txt”></textarea><span class=”errtxt”>
    </span>
    <input type=”submit” name=”Submit” class=”submit”/>
    </form>

    Step 2) : Add you script (jquery/java script) on header within “<head>”.
    & add this code as well just below the script…

    <script>
    $(document).ready(function(){
    $(‘.submit’).click(function(){
    vat txt = $(‘.txt’).val();
    if(txt)
    {
    $(‘.errtxt’).css(‘color’,’#ff0000′);
    $(‘.errtxt’).html(‘give me a text’);
    return false;
    }
    });

    $(‘.txt’).keypress(function(){
    $(‘.errtxt’).css(‘color’,’#117004′);
    $(‘.errtxt’).html(‘send successful’);
    });
    });

    </script>

    sorry, if error come. i didn’t test it. but surely this will work for you.

    Thank you,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to check if a Textarea is empty in Javascript or Jquery?’ is closed to new replies.