简体   繁体   中英

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. I am working in asp.net

Add a click event to the body. Check the event's target or srcElement to see where the click occured. See if the cilck occurs on an element that is in the panel.

Use focusin and focusout of Jquery.

<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");
});
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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