Home  >  Article  >  Web Front-end  >  How to deal with checkbox/radio onchange not compatible with ie8 in javascript

How to deal with checkbox/radio onchange not compatible with ie8 in javascript

黄舟
黄舟Original
2017-06-18 13:06:231705browse

This article mainly introduces the relevant information about javascript checkbox/radio onchange is not compatible with ie8. Friends in need can refer to it

javascript checkbox/radio onchange is not compatible with ie8 solution

Under ie8, checkbox onchange fails to trigger the custom function, how to solve this problem The problem is as follows:


function forIe(){ 
  if($.browser.msie){ //判断浏览器是否为ie 
    $("input[type='checkbox']").click(function(){ 
      this.blur(); //先失去焦点,执行你的自定义的操作 
      this.focus();//再获取焦点,是鼠标还在那个地方,好进行下一步的操作 
    }) 
  } 
}

Quote on the corresponding setting page:


$(function(){ 
    forIe(); 
  })

The above is the detailed content of How to deal with checkbox/radio onchange not compatible with ie8 in javascript. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn