简体   繁体   中英

How can i override the event variable in jquery

On click of document anywhere by default, it is coming as false I want to change it to true how can I do that..?

jQuery(document).click(function(e) {
console.log(e); //e.target.isConnected = false;
e.target.isConnected = true; //i want to overwrite
--logic--
--logic--
});

I am getting this error:

Uncaught TypeError: Cannot assign to read only property 'isConnected' of object '[object HTMLAnchorElement]'

My application is in angular 4

The isConnected is property holding a status information and because of that it is read only, and cannot be changed using an assignment.

Node.isConnected

The isConnected read-only property of the Node interface returns a boolean indicating whether or not the Node is connected (directly or indirectly) to the context object, eg the Document object in the case of the normal DOM, or the ShadowRoot in the case of a shadow DOM.

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