开发者

how to open model popup on textbox click

开发者 https://www.devze.com 2023-01-31 05:25 出处:网络
I want to open modelpopup only when my checkbox is checked and user clicks on textbox.but how to find checkbox in this

I want to open modelpopup only when my checkbox is checked and user clicks on textbox.but how to find checkbox in this

for this i wrote,

<script type="text/javascript" language="javascript">
  $(function() {
    $("#x").dialog({
      autoOpen: false,
      height: 200,
      width: 500,
      modal: true
    });
    $("#y").click(function() {
      $("#x").dialog("open");
      retur开发者_运维技巧n false;
    });
  });
</script>

where x->id which should be opened in popup y->textbox id


You can locate your check box from its id attribute and use the :checked selector to determine if it is checked:

$(function() {
    $("#x").dialog({
        autoOpen: false,
        height: 200,
        width: 500,
        modal: true
    });
    $("#y").click(function() {
        if ($("#yourCheckBoxId").is(":checked")) {
            $("#x").dialog("open");
        }
    });
}); 
0

精彩评论

暂无评论...
验证码 换一张
取 消