Home:ALL Converter>Reset btn dropdown-toggle to original status

Reset btn dropdown-toggle to original status

Ask Time:2015-03-18T09:47:53         Author:gogasca

Json Formatter

After my users select an option from dropdown menu, I want to reset dropdown button menu to original option "Select Service". In this case, user select an option, we do some processing and then we want to change dropdown menu tu "Select Service"

Based on: Bootstrap Reset Button in btn-group

I use this in my Javascript without luck:

debug('Deploy() Resetting button group status');
$('#button_group_1 button').addClass('active');

or

debug('Deploy() Resetting button group status');
$('#button_group_1 button').removeClass('active');

Nothing happens. This is the code:

<div class="btn-group">
                                    <button id="button_group_1" class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown">
                                    Select service
                                    <span class="caret"></span>
                                    </button>
                                        <ul class="dropdown-menu pull-left" role="menu" aria-labelledby="service_menu_1" data-id="service_menu_1">
                                        <!-- Only display Main services-->

                                            <li role="presentation"><a data-menu-option="opt1" data-id="1" href="#">option 1</a></li>
                                            <li role="presentation"><a data-menu-option="opt2" data-id="2" href="#">option 2</a></li>
                                            <li role="presentation"><a data-menu-option="opt3" data-id="3" href="#">option 3</a></li>
                                        </ul>
                                </div>    

I tried the Id inside div but same results. Any ideas?

Author:gogasca,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/29112838/reset-btn-dropdown-toggle-to-original-status
yy