jquery open select dropdown code example

Example 1: jquery dropdown select

$('select>option:eq(3)').prop('selected', true);

Example 2: open select dropdown

$('#MyButton').on("click",function(){
    $("#selecttest").attr("size", 8);
    $("#selecttest").css("position","fixed");
    $('#MyButton').css("margin-left", $("#selecttest").width() + 5);});
$('#selecttest').on("change",function(){
    $("#selecttest").attr("size", 1);});

Example 3: jquery select dropdown

$('#mySelectElement option')[0].selected = true;

Example 4: open select dropdown

var myDropDown=$("#myDropDown");
var length = $('#myDropDown> option').length;
//open dropdown
myDropDown.attr('size',length);