Ressources » JavaScript
Documentation about jQuery jSelect, plugin that enables to manage and load data in Select element.
$('#load_select').jselect({
data: [ [ 0, "Option First" ], [ 1, "Option Second", true, "my-class" ] ],
onChange: function(value, text){ isChange(value, text); },
loadUrl: "jselect.xml",
addOption: true,
addOptionUrl: "new-option.php"
});
| data | [] | Array that contains all elements to create the new Option (and Options by default) |
| dataType | "array" | Defined default data type (xml, array, json and html) |
| replaceAll | true | Replace content before adding new data? |
| onChange | function(){} | Function called on change of Select (return: value and text of selected Option and current jSelect element) |
| onComplete | function(){} | Function called when the process is done |
| loadUrl | null | URL called to load XML, HTML or JSON data |
| loadData | null | Parameters to complete URL to load |
| loadType | "POST" | Defined loading type (POST or GET) |
| loadOnError | function(){} | Function called if an error occured when loading data |
| loadDataType | "xml" | Defined loading data type (xml, array, json and html) |
| addOption | false | Set action to add option by prompt |
| addOptionUrl | null | URL called to save Option added in Select. Get ID of this new Option in return. |
| addOptionData | "newOption=" | Parameter name containing the text of the new option sent to addOptionUrl. |
| addOptionType | "POST" | Defined sending type (POST or GET) |
| addOptionValue | "-1" | Value of Option "Add an option" |
| addOptionText | "Add an option" | Text of Option "Add an option" |
| addOptionClass | null | Class of Option "Add an option" |
| addOptionPrompt | "Text of the new option:" | Text of the prompt to add an Option |
| addOptionSetSelected | true | The new Option must be selected after added ? |
| addOptionSetClass | null | Class of the new Option added |
| addOptionOnComplete | function(){} | Function called when process to add of Option is done (Only in version >= 1.1) |
| addOptionOnError | function(){} | Function called if Option wanted has ""(empty) as value (return: text wanted for Option and current jSelect element) |