简体   繁体   English

ContentEditable Div模糊事件

[英]ContentEditable Div blur event

I am using a content editable div as an input control but it does not send information to the server like a textarea or input element does so I've used the blur event to transfer the information from the div to a hidden field and then sending the value of the hidden field to the server. 我使用内容可编辑div作为输入控件但它不像textarea或输入元素那样向服务器发送信息,所以我使用blur事件将信息从div传输到隐藏字段然后发送隐藏字段的值到服务器。

This works intermittently, my question is. 这是间歇性的,我的问题是。 Is there a better way? 有没有更好的办法? Is there some way to send the value of innerHTML or innerTEXT of the mentioned div element or should I be using a different event (Maybe focus on the button). 有没有办法发送上面提到的div元素的innerHTML或innerTEXT的值,或者我应该使用不同的事件(也许专注于按钮)。 Not sure. 不确定。

您可以检测div外部的单击,但它与onblur具有相同的效果,onblur实现起来要好得多。

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

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