gfranko / jquery.selectBoxIt.js

A jQuery Select Box Plugin for Mobile, Tablet, and Desktop
http://www.selectboxit.com
MIT License
852 stars 301 forks source link

Calling selectOption result in Uncaught RangeError: Maximum call stack size exceeded #391

Open sumitparkash opened 5 years ago

sumitparkash commented 5 years ago

When you try to call the selectOption inside the change method ,it result in Uncaught RangeError: Maximum call stack size exceeded

I need to reset the value of the select box to default once the user select a option. So i try to set the selectOption(0) on the change event . Here is the code

 <select id="test" name="test" >
            <option value="SelectBoxIt is:">SelectBoxIt is:</option>
            <option value="a jQuery Plugin">a jQuery Plugin</option>
            <option value="a Select Box Replacement">a Select Box Replacement</option>
            <option value="a Stateful UI Widget">a Stateful UI Widget</option>
        </select>
    $(function ($) {  
            var el = $('select#test');
            el.selectBoxIt();
            el.on('change', function (e) {
               var selectBox = el.data("selectBox-selectBoxIt");
               selectBox.selectOption(0);
            })
    });
</script>

But results in error

Could you possible suggest any solution.