0

I have this code inside a form of mine:

<textarea>Your message</textarea> 

The html content of the tag will be emptied on focus.

I want to run some validation on this field with jQuery. First, the value of this field should not be = "". Secondly, the content of the tag should not be = "Your message".

Anyone knows how I can archive this in the most efficient way?

1

2 Answers 2

2

I would recommend using jQuery validation plugin which can be found at bassisance.de

Sign up to request clarification or add additional context in comments.

Comments

1

Try

$('form').submit(function(){
    var form=$(this);
    var text=form.find('textarea');
    if(text!="" && text!="Your message"){
        return true;
    }else{
        return false;
    }
    });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.