/** * Created by IntelliJ IDEA. * User: mcanas * Date: Oct 8, 2010 * Time: 9:34:07 AM * To change this template use File | Settings | File Templates. */ (function($) { var toggleDisplay; // Define the public methods var methods = { /* * The initializer method * Called automatically when no registered methods are passed to the $.jSelect function * */ init : function() { // Check if the object has a selector attached to it. if(!this.selector) { // If no selector is attached, return a collection of converted jSelect's, or a single jSelect return this.length > 1 ? this : this[0]; } else { /* * If a selector is attached, the SELECT object/s needs to be converted into a jSelect object/s * We use recursion to return jSelect's DOM instead of the replaced SELECT's DOM * */ return methods.init.apply(this.map(function() { var $this = $(this); // Store jSelect attribute data var attr = { name : $this.attr('name'), hoverState : 'out', menuState : 'closed', target : $this, type : $this.attr('type'), value : $this.val() }; // Build the DOM structure var $selectTag = $('
'), // The wrapper $selectedTag = $(''), // The tag used to display the current selection $menuTag = $('
'), // The drop down wrapper $valueTag = $(''), // The form element to store the selected value $defaultOption; // Replacement for the default