Created
October 5, 2012 14:55
-
-
Save og-shawn-crigger/3840279 to your computer and use it in GitHub Desktop.
Chosen Select Box Value/Text getter
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ------------------------------------------------------------------------ | |
// SET NAMESPACE TO AVOID CONFLICTS AND HOLD CONFIG VALUES | |
// ------------------------------------------------------------------------ | |
var App = App || {}; | |
// Basic Config and Language Options | |
App = { | |
config : {}, | |
/** | |
* Returns selected Chosen option value and text. | |
* | |
* @param object event Reference to Chosen object. | |
* | |
* @return object | |
*/ | |
getChosenVals : function(event) { | |
var that = $(event.target); | |
var vals = {val: that.val(), text: that.find(":selected").text()}; | |
/* | |
var value = $("#organization_id").find(":selected").text(); | |
//var len = value.length; | |
if (len > 20){ | |
value = value.substr(0,17) + '...'; | |
} | |
*/ | |
return vals; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment