简体   繁体   English

当用户在asp.net中点击外部面板时如何获取警报消息

[英]How to get alert message when user click on outside panel in asp.net

I have form in which I have several controls. 我的表格中有几个控件。 My concern is that when I filling values in Panel1 , & click on any other control or space outside panel1 .How can I get alert message. 我担心的是,当我在Panel1中填充值时,单击panel1之外的任何其他控件或空间。如何获取警报消息。 I am working in asp.net 我在asp.net工作

Add a click event to the body. 向主体添加单击事件。 Check the event's target or srcElement to see where the click occured. 检查事件的目标或srcElement以查看发生单击的位置。 See if the cilck occurs on an element that is in the panel. 查看cilck是否出现在面板中的元素上。

Use focusin and focusout of Jquery. 使用Jquery的focusin和focusout。

<div style="border: 1px solid black;padding:10px;">
   First name: <input type="text"><br>
  Last name: <input type="text">
</div>`
<script>
$(document).ready(function(){
$("div").focusin(function(){
    $(this).css("background-color", "#FFFFCC");
});
$("div").focusout(function(){
    $(this).css("background-color", "#FFFFFF");
});
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM