Question

I am looking at: CoolInput, but I need a destroy method.

I want to be able to do something like this:

$('#manualhint2').coolinput('foobar');

but I also need a method like:

$('#manualhint2').coolinput(destroy);  

or something like that, because there are times when I need to disable CoolInput.

Can somebody please help me?
Or, you can also recommend another jquery hint library that has a destroy method.

Thanks!

Was it helpful?

Solution

Have you tried

$('#manualhint2').coolinput(''); 

?

OTHER TIPS

With a bit explore in CoolInput code, I got this:

$(selector).each(function () {
  EmptyThisCoolInput($(this));
});

function EmptyThisCoolInput(o) {
  try {
    if (o.val() == o.attr(coolInputAttribute) && o.hasClass(coolinputBlurClass))
      o.val("").removeClass(coolinputBlurClass);
  } catch (e) { }
}

I separated EmptyThisCoolInput because I call this somewhere else. you can safely use this syntax:

$(selector).each(function () {
  try {
    if ($(this).val() == $(this).attr(coolInputAttribute) && $(this).hasClass(coolinputBlurClass))
      $(this).val("").removeClass(coolinputBlurClass);
  } catch (e) { }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top