jeudi 28 mai 2015

HTMLElement.click() on checkbox not working in firefox

use case:- When user clicks on checkbox "A", Checkbox "B" should gets enabled and gets checked automatically.

Issue:- "B" is getting enabled but not getting checked.This issue is happening in firefox, in chrome it's working fine

<!doctype html>
<html>
<title></title>
<head>
<meta http-equiv="Content-Type"
content="text/html;charset=ISO-8859-1">   
<script src="http://ift.tt/AbJPU3"></script> 
<script>
$(document).ready(function(){
      var self = this;
      self.context = $(document.body);
      self.first = $("#123");
      self.second = $("#456");
      self.context.delegate("#123","click",function(e){
         self.context.trigger("first/changed",this);
      });
      self.context.delegate("#456","click",function(e){
           self.context.trigger("second/changed",this);
      });
      self.context.bind("first/changed",function(e,obj){
                self.second.attr({
                   "disabled": ""
                });
                self.second.trigger("click");//**click event is not getting fired**
       });
}); 
</script>     
</head>
<body>
<ul class="main">
<li class="main-list">
    <input type="checkbox" id="123"><span>A</span>
    <ul class="sub">
        <li class="sub-list1">
            <input type="checkbox" id="456" disabled><span>B</span>
        </li>
        <li class="sub-list2">
            <input type="checkbox" id="789" disabled><span>C</span>
        </li>
    </ul>
</li>  
</ul>  
</body>
</html>




Aucun commentaire:

Enregistrer un commentaire