John Livermore
John Livermore

Reputation: 31313

jQuery textbox hinter plugin

I have a page with a textbox defined like...

<input type="text" hinttext="Here is the hint text" />

I am trying to set the 'hint' text of the control using the tbHinter call and have tried...

$('input').tbHinter({ text: this.getAttribute('hinttext') });

and

$('input').tbHinter({ text:this.attr('hinttext') });

neither work.

I know I am missing something obvious. Can someone point me in the right direction please?

Upvotes: 0

Views: 539

Answers (1)

Mark Coleman
Mark Coleman

Reputation: 40863

In your initial example this most likely is going to be a reference to the window. To accomplish this you will need to iterate over each input box so you have a reference to the input.

$('input').each(function(){
  $(this).tbHinter({ text: $(this).attr('hinttext') });
});

Example on jsfiddle.

Upvotes: 2

Related Questions