Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
184
rated 0 times [  185] [ 1]  / answers: 1 / hits: 36568  / 10 Years ago, fri, july 25, 2014, 12:00:00

Currently I'm trying to create a button which creates a popup box which in turn has a drop down list, like in here. However, I'm having trouble figuring out how to put the drop down list inside the pop up window. Can anyone help?



I currently have a pop up window with a form, but I want to change this form into a drop down list. refer this jsfiddle



<p>Do you have an agreement or a conflict?</p>
<button onclick=myFunction()>Try it</button>

<p id=demo></p>

<script>
function myFunction() {
var person = prompt(Please enter your name, );

}
</script>

More From » html

 Answers
10

Here's a possible demo solution.





$('#dialog').hide();
$('#target').click(function() {
$('#dialog').show();
$('#dialog').dialog();
});

<script src=https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js></script>
<script src=https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js></script>
<link href=https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css rel=stylesheet/>

<div id=dialog title=Basic dialog>
<select>
<option value=volvo>Volvo</option>
<option value=saab>Saab</option>
<option value=mercedes>Mercedes</option>
<option value=audi>Audi</option>
</select>
</div>

<input type=button id=target value=click />




[#70043] Wednesday, July 23, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kristinsonjab

Total Points: 364
Total Questions: 98
Total Answers: 98

Location: Christmas Island
Member since Mon, Oct 19, 2020
4 Years ago
kristinsonjab questions
Fri, Mar 4, 22, 00:00, 2 Years ago
Fri, Jan 22, 21, 00:00, 3 Years ago
Fri, Aug 14, 20, 00:00, 4 Years ago
;