Jquery Toggle two function not work in 1.10.1

前端 未结 7 2013
执念已碎
执念已碎 2020-12-17 03:04

Jquery Toggle two function not work in jquery 1.10.1 but work\'s on Jquery 1.8.3

HTML

For example, consider the HTML:

7条回答
  •  臣服心动
    2020-12-17 03:42

    toggle is not working for me in jquery so with the help of stackoverflow my alternative is

    and here is implementation or you can say alternative of toggle function

    $('#thiclik').click(function()
    {
    //toggle alternative 
    
    	function handler1() {
    		//alert("first handler for .toggle() called.");
    		$("#clickevent").text("Yes");
    		$('#thiclik').one("click", handler2);
    	}
    	function handler2() {
    	//	alert("second handler for .toggle() called.");
    		$("#clickevent").text("No");
    		$('#thiclik').one("click", handler1);
    	}
    	$("#thiclik").one("click", handler1);
    });
    working for me but with little problem when i click first time on click me it not work but on second and third time it works fine.

提交回复
热议问题