So I have this problem, using toggle(). The thing is that when I use toggle instead of click the block slides away from the page after reload, that I can't even, well, toggle the block. here is the code
If I use .click( ) instead - it works, but if I write "toggle", the block slides away as soon as I reload the page not giving me to toggle itself.
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8" />
<title>Email input page</title>
<link href="css/styles.css" rel="stylesheet" type="text/css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="js/scripts.js">
$(document).ready(function($) {
$('#newdiv').on('toggle', function() {
$(this).css({
'background': 'black',
'color': 'white'
});
}, function() {
$(this).css({
'background': 'green',
'color': 'red'
});
/!* Stuff to do every *even* time the element is clicked *!/
});
});
</script>
</head>
<body>
<input value="enter your email:" type="" name="" />
<div id="newdiv">
test div for test something
</div>
</body>
</html>
toggle(fn,fn)was deprecated in 1.8 and then later removed 1.9