"Get value dropdown to input bootstrap input group"
Bootstrap 3.0.0 Snippet by ytre

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="input-group"> <input type="hidden" name="lang_id"> <div class="input-group-btn"> <span id="lang" class="btn btn-sm btn-primary">Select language</span> <button type="button" class="btn btn-sm btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></button> <ul class="dropdown-menu dropdown-menu-right"> <li><a data-id="">Select language</a></li> <li><a data-id="1">Polish</a></li> <li><a data-id="2">English</a></li> </ul> </div><!-- /btn-group --> </div><!-- /input-group --> </div>
span{width:200px;text-align:left;}
$(document).on('click', '.dropdown-menu li a', function(e) { var selText = $(this).data('id'); var selText2 = $(this).text(); $(this).closest('.input-group').find('input[name="lang_id"]').val(selText); $(this).closest('.input-group').find('span#lang').text(selText2) });

Related: See More


Questions / Comments: