Change selected value of DDSlick dropdown using JavaScript

In my website, I am using the DDSlick plugin for styling my select dropdown. It is nice. But I can’t change the selected value using javascript.

For example, if the current selected value is “INDIA”, then I want to change “INDIA” to “USA” by using javascript, without refreshing the page. Is there any way to do this?

Thanks in advance.

Get value of selected in ddSlick dropdown

This currently returns undefined. What should go in the commented line to alert the value (1, 2, 3 or 4) of the current <option> tag? <select id=dropdown name=dropdown> <option valu



How to get value of selected in ddSlick dropdown

I use some ddslick drop down menus in a form and I want to get the selected values when submit that form. Already try to create a hidden input near that menus: <input type=hidden name=hiddeninpu

Using ddSlick and selecting an item in the list by value rather than index

I’m using ddSlick to change my drop down menus into prettier ones; http://designwithpc.com/Plugins/ddSlick But I have a problem. I rely on programatically changing the selected item in a list, but I m

ddslick select options won’st post value of selected option – jquery plugin

I am using ddslick to make drop down menu’s with icons, the only trouble is when I post the form the value of the selected option is always empty, it works fine if I turn ddslick off. <script langu

Display the selected value in dropdown without using javascript

How to Display the selected value when the option is selected in dropdown menu in phtml without using javascript.here is what i have tried so far!.i am trying this one in magento <form action=<

Reset a ddslick json dropdown to its initial state

I’m using ddslick (jquery plugin) to create two json dropdowns on my page: var DataComms = [ { text: 7000C, value: 1, selected: false, imageSrc: images/7000C.jpg }, { text: 6000, value: 2, selec

How can I get dropdown selected value using javascript?

I have an asp.net DropdownList Control. when i use this code var id = $([id*=’drpCategory’] option:selected).val(); the id is always come first index of dropdown. How can i get other selected value

Gel Selected value from dropdown using Javascript [duplicate]

This question already has an answer here: Get selected value of dropdownlist using JavaScript? 10 answers I have the following HTML <form> <div class=answer1wrap> <select id=m

DDSlick ‘selected’ attribute ignored on element

I am using the following jQuery plugin: http://designwithpc.com/Plugins/ddSlick To show selectable images in a dropdown select box. It is working great apart from when I try to load the html with an o

How to change “selected” value using JavaScript? [duplicate]

Possible Duplicate: How to change “selected” value in combobox using JavaScript? So here’s my code <label class=conl>Pokaż wyniki jako <br><select name=show_as> <option val

Answers

If you want force a specific selected items on click on buttons you culd use this code.

<!DOCTYPE HTML>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.ddslick.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $('#dropdown').ddslick({
        width: 300,
        selectText: "Select an item",
        onSelected: function (data) {
            console.log(data)
        }
    });

    $('#button').on('click', function () {
           $('#dropdown').ddslick('select', {index: 2 });
    });
})
</script>
</head>
<body>
<select id="dropdown">
    <option>select</option>
    <option id="a" value="">INDIA</option>
    <option id="b" value="">USA</option>
    <option id="c" value="">AFRICA</option>
</select>
<input name="" type="button" value="change" id="button">
</body>
</html>

with similar code you can create a button to browse through all the options in the list
fiddle
If this solution does not suit your needs, i apologize for making you lose time.