Depends how accurate you need to be.

var hasCssError = myVar.indexOf('css-error') > -1;

will set hasCssError TRUE if the text 'css-error' exists in your myVar
variable.

If that's enough, without needing to test specifically for class="css-
error", then there you go. Otherwise just extend the test string ...
indexOf('class="css-error"')

On Nov 28, 10:20 am, Cati <[EMAIL PROTECTED]> wrote:
> Hello.
>
> I have a question, I think this is a small things, but I don't know
> the answer.
>
> I have a variable:
> var myVar = '<div class="css-error">You must fill</div><div
> class="field">Fields...</div>';
>
> How can I decide: Is there a "css-error" class in myVar?
>
> Thanks
> Cati

Reply via email to