$(document).ready(function() {
$("div").css({
"width":"80px",
"height":"40px",
"margin":"5px",
"float":"left",
"background-color":"blue",
"border":"10px outset",
"cursor":"pointer"
});
$("div").toggle(function(){
$(this).css({
"border":"5px inset",
"background-color":"red"
});
},function(){
$(this).css({
"border":"10px outset",
"background-color":"yellow"
});
},function(){
$(this).css({
"background-color":"blue"
});
});
});
This codes works in Jquery 1.4.2 but , doesn't work in 1.9.1 , Why? What can i do to use in JQ 1.9.1
Asked
Active
Viewed 484 times
0
-
replace .toggle with a click event + flag – Kevin B Feb 27 '13 at 16:07
-
1toggle is deprecated in jQuery version 1.9 – Eli Feb 27 '13 at 16:08
-
jQuery toggle was removed in 1.9.1 http://jquery.com/upgrade-guide/1.9/#toggle-function-function-removed The answer at http://stackoverflow.com/questions/4911577/jquery-click-toggle-between-two-functions contains a solution. – simbolo Feb 27 '13 at 16:09
1 Answers
2
The .toggle()
you're using was deprecated in jQuery 1.8 and removed in 1.9.
http://api.jquery.com/toggle-event/
You'll need to replace it with the .click()
function, or write your own function simulate the old functionality.
-
"Doesn't work" isn't very helpful. Post a jsFiddle of what you tried please. – j08691 Feb 27 '13 at 16:21