I am using chosen jquery plugin for my select input. I want to reset select option on click on a tag so doing so I want to access jquery plugin function. DEMO
HTML
<select id="second" class="chzn-select" style="width:100px">
<option value="0"> select</option>
<option value="1"> mr</option>
<option value="2"> mrs</option>
</select>
<a href="#">reset</a>
jquery
$(".chzn-select").chosen()
$('a').click(function(){
$.chosen({results_reset})
})
function from plugin
Chosen.prototype.results_reset = function () {
this.form_field.options[0].selected = true;
this.selected_item.find("span").text(this.default_text);
if (!this.is_multiple) this.selected_item.addClass("chzn-default");
this.show_search_field_default();
this.results_reset_cleanup();
this.form_field_jq.trigger("change");
if (this.active_field) return this.results_hide();
};
Here is the link for complete plugin
http://harvesthq.github.com/chosen/chosen/chosen.jquery.js
Edit
To call a plugin function, you can do:
Demo: http://jsfiddle.net/vCE4Y/12/
You do not need to access plugin code to reset the select. You can reset it as follows:
Demo: http://jsfiddle.net/vCE4Y/11/