jquery - Bootstrap dropdown option not showing after selected -


I have the following form, when the dropdown is clicked and one option is selected, the option does not appear at the top :

  & lt; Div class = "input-group" & gt; & Lt; Div class = "input-group-btn" & gt; & Lt; Button type = "button" class = "btn btn-default dropdown-toggle" data-toggle = "dropdown" area-expanded = "wrong" & gt; +1 & lt; Span class = "caret" & gt; & Lt; / Time & gt; & Lt; / Button & gt; & Lt; Ul class = "dropdown-menu" role = "menu" & gt; & Lt; Li & gt; & Lt; A href = "#" id = "1" & gt; America: + 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" id = "44" & gt; UK: +44 & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; & Lt; Input type = "text" class = "form-control" aria-label = "..." placeholder = "your phone number" & gt; & Lt; Span class = "input-group-btn" & gt; & Lt; Button class = "btn btn-default" type = "button" & gt; SUBMIT & lt; / Button & gt; & Lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt; Load dialog on page load $ ('# basic-modal-content')  

jquery

  // modal (); // Click Load Dialog $ ('#interface- modal.basic'). Click (function (e) {$ ('# basic-modal-content'). Modal (); return false;});  

There is a bootline that has the button Html

& lt; Div class = "input-group" & gt; & Lt; Div class = "input-group-btn" & gt; & Lt; Button id = "label" type = "button" square = "btn btn-default dropdown-toggle" data-toggle = "dropdown" aria-expanded = "false" & gt; +1 & lt; Span class = "caret" & gt; & Lt; / Span & gt; & Lt; / Button & gt; & Lt; Ul class = "dropdown-menu" role = "menu" & gt; & Lt; Li & gt; & Lt; A href = "#" id = "1" & gt; America: + 1 & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "#" id = "44" & gt; UK: +44 & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt; & Lt; Input class = "form-control" aria-label = "..." placeholder = "your phone number" type = "text" & gt; & Lt; Span class = "input-group-btn" & gt; & Lt; Button class = "btn btn-default" type = "button" & gt; SUBMIT & lt; / Button & gt; & Lt; / Span & gt; & Lt; / Div & gt;

Javascript:

  $ ("# 1, # 44"). Click (function (e) {$ ("# label"). Html ("+" + $ (this) .attr ("id") + "& lt; span class = 'carat' & gt; & lt; / Span & gt; ");});  

According to the comments, I really do not know what is the second part of the code for your question, but changing the value of the button is very easy depending on the item you click on . Note, I've added a id = "label" to make it easier and easier to do.

Hope that helps!


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -