Input with clear button for Famo.us
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
src
.gitattributes
.gitignore
README

README

Famous ClearInput Widget
==========================

This is a Famo.us Input with the possibility to add a clear button (ImageSurface) inside, on near the right border.


Usage
-----

    // Your basic Famo.us setup
    var mainContext = Engine.createContext();

    // Create the new field and set the 'x' image with the clearImage property
    var ci = new ClearInput({
        size:[250,35],
        placeholder: 'search',
        clearImage: 'content/images/delete-icon.png'
    });
    
    // Add it to Famo.us main context
    mainContext.add(ci);
    
    // Use 'inputCleared' event to know when the field has been cleared
    ci.ev('inputCleared', function() { /*do something*/ });
    
    // Use getValue() and setValue('') as normal Famo.us input
    var ciValue = ci.getValue();
    ci.setValue(ciValue);
	
	// Get Focus
	ci.focus();
	
	// Set Properties
	ci.setProperties({visibility:'hidden'});