Dyapa Srikanth
Dyapa Srikanth

Reputation: 1241

jquery validator plugin ignore title attribute to show error message

How can I ignore title attribute to show error message in jquery validator plugin. Because i am using that title to show tooltip not for error message.

plugin initialization

$('#participantform').validate();

form element to validate

<input name="o_phone_cnt" class="inputtextie required digits" title="Country Code" style="width:25px" type="text" minlength="1" size="3" maxlength="3"/>

on button click

$('#sendmail_ppnt').button().click(function(){
      $('#participantform').submit();
});

at the validation time it showing error message as required, but after adding the title to the input:text element it is showing Country Code as error message.

how to configure validator plugin to ignore title attribute to show error message.

Upvotes: 2

Views: 3358

Answers (1)

Fr&#233;d&#233;ric Hamidi
Fr&#233;d&#233;ric Hamidi

Reputation: 262919

You can pass the ignoreTitle option to validate():

$("#participantform").validate({
    ignoreTitle: true
});

In passing, note that the documentation says (emphasis mine):

Set to skip reading messages from the title attribute, helps to avoid issues with Google Toolbar; default is false for compatibility, the message-from-title is likely to be completely removed in a future release.

So, chances are you won't have to anything to obtain the behavior that you want with future releases of the plugin.

Upvotes: 6

Related Questions