简体   繁体   中英

Firing event when TextBox is blank

I need to fire an event when a TextBox in ASP.NET has been defocused - I currently handle the TextChanged event for this, but this obviously doesn't fire if they don't type into the box and then defocus. Can I do this?

EDIT: To clarify, I want to fire a server side event - not client side

$('input').blur(function() {
   if ($(this).val() == ''){
      __doPostback('MyMethod')
   }
});

protected void MyMethod()...

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