Jump to content

.click() and function toggle are not working well in Chrome and Microsoft Edge but working well in Internet Explorer 11. Why?


Kaung Khant Naing

Recommended Posts

$(".hideicon").click(function(){ //hide downtime
		var id = $(this).val();
		var dt = id.split('|');
		var sh = 'h';
		toggle(dt[0], dt[1], sh);
	});

	$(".showicon").click(function(){ //hide downtime
		var id = $(this).val();
		var dt = id.split('|');
		var sh = 's';
		toggle(dt[0], dt[1], sh);
	});

	$(".hidep2qrtr").click(function(){ // previous year quarter
		hideprev2qrtr()
	});

	$(".hidepqrtr").click(function(){ // previous year quarter
		hideprevqrtr()
	});

	$(".hideright").click(function(){ // previous year months
		hideprevyear()
	});

	$(".hideitrgt").click(function(){ // itarget
		hideittarget();
	});

	$(".hide4week").click(function(){ // latest 4 weeks
		var l = $('#lweek').val();
		var m = $('#lmnth').val();
		hidecurrweek(l, m)
	});

});

	function toggle(x, y, z){
		var max = $('#subCt').val();
		if(x == 'x'){ //show/hide all
		    if(z == 's'){
				var arry = $('.hideicon');
		    } else {
				var arry = $('.showicon');
		    }
		    for(var i = 1; i < arry.length; i++){ 
		    	var raw = $(arry[i]).val().substr(0, 2);
		    	//alert(raw);
		    	if(z == 'h'){
					$('.'+raw+'1').hide(); // table row
								
					$('.showicon').show(); // show icons
					$('.hideicon').hide(); // hide icons

					$('#imgShow'+y).show(); // show all icon
					$('#imgHide'+y).hide(); // hide all icon
					
					$('#body').css("height", "auto");
					$('#body').css("padding-bottom", "30px");
					$('#footerDiv').css("bottom", "0%");	
					
					openSubCategory = 0;
				} else {
					$('.'+raw+'1').show();
					
					$('.showicon').hide();
					$('.hideicon').show();
				
					$('#imgShow'+y).hide();
					$('#imgHide'+y).show();

					$('#body').css("height", "auto");
					//alert('footer to bottom');
					$('#body').css("padding-bottom", "30px");
					$('#footerDiv').css("bottom", "-13%");

					openSubCategory = max;
				}
		    }
		} else {
			if($('.'+x+'1').is(':visible')){
				//alert('close');
				$('#imgHide'+y).hide();
				$('#imgShow'+y).show();
				$('.'+x+'1').hide();
				openSubCategory--;
				if(openSubCategory != 0){
					$('#imgShow0').show();
					$('#imgHide0').show();
				}
				if(openSubCategory == 0){
					$('#imgHide0').hide();
				}
				if(openSubCategory <= 7){
					$('#footerDiv').css("bottom", "0%");	
				}
			} else {
				//alert('open');
				$('#imgShow'+y).hide();
				$('#imgHide'+y).show();
				$('.'+x+'1').show();
				openSubCategory++;
				if(openSubCategory != 0){
					$('#imgShow0').show();
					$('#imgHide0').show();
				}
				if(openSubCategory == 0){
					$('#imgShow0').hide();
				}
				if(openSubCategory >= 8){
					$('#footerDiv').css("bottom", "-13%");	
				}
			}	
		}
		//alert('open sub count: '+openSubCategory);
	}

These are the codes for the .click() and function toggle. In the pictures, first two pics are in IE11 and it's working perfectly. But in Edge or Chrome, the toggle button is not working anymore and causing error. May I know how can I fix this issue?

IEkpi.png

kpiietwo.png

kpiedge.png

kpiedge2.png

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...