弹出复选框时选中

时间:2015-06-12 11:49:05

标签: javascript jquery html

在我们的estore结账时,我们有各种交付选项,对于某个交付选项,我们希望在选中时显示一个弹出框,特定选项复选框如下:

<input id="delivery_option_22_6" class="delivery_option_radio" type="radio" name="delivery_option[22]" data-key="76," data-id_address="22" value="76,">

如果选中此复选框,有人可以告诉我如何创建弹出窗口,这会显示我们选择的消息吗?

谢谢!

3 个答案:

答案 0 :(得分:1)

使用onclick收音机(不需要JQuery)

<input id="delivery_option_22_6" onclick="alert('message')" class="delivery_option_radio" type="radio" name="delivery_option[22]" data-key="76," data-id_address="22" value="76,">

答案 1 :(得分:0)

首先确保脚本中有jQuery

onevent="click"

弹出窗口使用此库

http://vodkabears.github.io/remodal/#

或者

http://dimsemenov.com/plugins/magnific-popup/

答案 2 :(得分:0)

这样的事情:

HTML:

<input id="delivery_option_22_6" class="delivery_option_radio"  type="radio" name="delivery_option[22]" data-key="76," data-id_address="22" value="76," data-popup="Test message">

<div class="popup" style="display:none"></div>

JavaScript的:

$('input[data-popup]').on('change', function(){
    if($(this).is(':checked')) {
        // Popup function
        $('.popup').text($(this).data('popup')).show();
    }
})

示例:https://jsfiddle.net/L1Lmz8oo/