admin 管理员组文章数量: 1086019
Please let me know how to open a pop-up on click of a radio button using JQuery. Currently Im using a the following code for a radio button using Spring MVC and JSTL
<label class = "">
<form:radiobutton path = "" value = "" onchange= ""/>
<label class = "" style = ""> <spring:message code ="" /></label>
</label>
Many Thanks
Please let me know how to open a pop-up on click of a radio button using JQuery. Currently Im using a the following code for a radio button using Spring MVC and JSTL
<label class = "">
<form:radiobutton path = "" value = "" onchange= ""/>
<label class = "" style = ""> <spring:message code ="" /></label>
</label>
Many Thanks
Share Improve this question asked Jun 21, 2013 at 3:43 ronanronan 4,67213 gold badges53 silver badges68 bronze badges3 Answers
Reset to default 3I am assuming you mean a new window by pop-up
?
The following code will open a new window with the URL when the status of the radio button changes. You can use click
if you like...
$("#pop").change(function() {
window.open("http://www.google.");
});
<input type="radio" id="pop" value="yes">
JSFiddle Example
I hope this will solve your problem.
onchange= "window.open("http://www.stackoverflow.",width=200,height=100); "/>
EDIT1: Removing the hide
class does the trick.
jQuery:
$(document).ready(function () {
$('input[type="radio"]').click(function () {
$('#r').removeClass("hide");
});
});
HTML:
<input type='radio'>SO
<div id="r" selectOption="#" class="modal hide" tabindex="-1" role="dialog" style=" background-color:#ccc; height: 100px;width: 350px"></div>
EDIT2:
If you check my html code, you will see an id for div named as "r" (unique selector) and class name "hide" prevent the div to be displayed. Therefore the div is hidden.
When the radio button is click, using removeClass we're removing the class "hide" this make the div visible.
Check this JSFiddle
Hope you understand.
you mean like this? CLICK HERE
HTML
<input type='radio' id='myRadio'>Radio button
JQuery
$(document).ready(function()
{
$('#myRadio').click(function()
{
alert("Clicked");
});
});
本文标签: javascriptDisplay a popup on radio button clickStack Overflow
版权声明:本文标题:javascript - Display a pop-up on radio button click - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744006543a2517392.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论