Wednesday 7 August 2013

create a pop-up window and display a list of radio buttons using javascript

create a pop-up window and display a list of radio buttons using javascript

I'm writing on a js file. Here is what I've tried so far. (My code is a
bit long but here is what I'm trying to do)
var popUpList= $ ('<input type="radio">A<br> <input type="radio">B<br>
<input type="radio">C');
var showPopUpButton=$('<button type="button">Select a Letter</button>');
// showPopUpButton is appended to the body
showPopUpButton.click(function() {
alert(popUpList);
});
When I click on showPopUpButton, the alert window shows [object Object],
which I guess means that the variable popUpList is empty. I couldn't find
how to do that in javascript.
I also tried with jQuery as suggested here Create a popup with radio box
using js
var popUpList= $ ('<input type="radio">A<br> <input type="radio">B<br>
<input type="radio">C ');
showPopUpButton.click(function() {
popUpList.dialog();
});
Now, the buttons are displayed but not inside a pop-up window! And they
are all superposed. Any help will be appreciated.
Thanks!

No comments:

Post a Comment