javascript - attachEvent not working in chrome browser for focusout event -


i have below code working fine in ie 9 when going through chrome getting error 'element has no method"attachevent"'. tried using.on addeventlistener() still unable through. element used here sharepoint people picker field. referring jquery 2.1.

please advice if missing anything?

code:

var element = getpeoplepickerrelcontrol("user", "div[title='people picker']");      if (element != null) {         $(element).focusin(function () {             _cardholderinfo = getuserdetails(element.innerhtml);         });        // if(element.attachevent)        element.attachevent("onfocusout", manipulateleaderprofile); 

attachevent specific ie only. if want attch event in chrome should use addeventlistener method. attach events shown below

if(navigator.useragent.tolowercase().indexof('msie') != -1){     element.attachevent("focusout", manipulateleaderprofile); } else{     element.addeventlistener("focusout", manipulateleaderprofile, false); } 

hope you.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -