Overview

SearchBox is simple JavaScript class that creates an UI widget similar as the OS X GUI searchboxes with the following components:

  • Optional text placeholder (like the word "Google" in the Safari search box).
  • If there is user input in the textfield, a 'clear' button appears to the right of the text.
Default Options
Name Description Type Default Value
labeltext Text value for the optional placeholder. String 'Search'
events All events applied to the input element by Element.set method - onKeyup, onBlur, onFocus, onChange. Object {}

 

Methods

With the public methods an application or component will have some control over the behavior of the Links Manager.

Name Description Parameters Returns
getValue Gets the field value. - Field value
setValue Sets the field value. value -
getField Returns input element. - DOM Element
inject Injects the wrapper into given placeholder, same as Element.inject(). element, position -

 

Examples

var search_box = new SK.UI.SearchBox({
      labeltext   : 'Search Google',
      events      : {
         keyup : function() {
            alert(this.value);
         }
      }
   }
);

search_box.inject(_$('placeholder_id'));