Erol
Erol

Reputation: 370

Stop JQuery Tools Tooltip from appearing on undefined title values

<input id="name" name="user[name]" size="30" title="Please enter a valid name." type="text" />
<input id="email" name="user[email]" size="30" type="text" />

$(document).ready(function(){
  $(':text').tooltip({
    events: {
      input: 'mouseover, mouseout'
    },
    opacity: 0.95,
    position: 'top center',
    effect: 'slide',
    tip: 'test.field-tip',
    onBeforeShow: function(args){
      if(this.getTrigger().data('title') == undefined)
        return true;
      return false;
    }
  });
});

The tooltip should only appear the on name since it is the only field with a given title. That's how I'm trying to approach it, but it doesn't seem to work. Any ideas?

Upvotes: 1

Views: 1210

Answers (1)

nickf
nickf

Reputation: 546493

Change your selector to

$(":text[title]")

Upvotes: 3

Related Questions