I\'m using the Jquery Chosen plugin on a select box, however I\'d like to focus this on page load. I\'ve used the following code to focus a text input:
onLoa
I have been searching into StackOverflow for this solution to use in one of my project. After searching a lot I have learned something but have got no proper solution. Finally I have fixed my problem as follows:
I am using "jquery-1.10.2.min.js"
and "Chosen v1.0.0"
. In my code I have and in jquery
$("#sel_product").chosen()
. For adding focus I have added '_chosen' after my ID of the element and call the following function:
$('#sel_product_chosen a.chosen-single').focus();
My final code is:
$(document).ready(function(){
$("#sel_product").chosen();
$('#sel_product_chosen a.chosen-single').focus();
});
Now it's working perfectly.