index.html:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery-1-10-1.js"></script>
<script type="text/javascript" src="jquery-ui-1-9-2.js"></script>
<script>
$(document).ready(function(){
$("#button1").click(function(){
$("#div").css("background","red");
//some code here
});
});
$(function(){
function first(){
$("#div").css("background","red");
$(this).one("click",second);
}
function second(){
$("#div").css("background","blue");
$(this).one("click",first);
}
$("#button2").one("click",first);
});
</script>
</head>
<body>
<input type="button" id="button1" value="button1"></input>
<input type="button" id="button2" value="button2"></input>
<div id="div">some text</div>
</body>
</html>
, что я должен положить в код здесь, когда я нажимаю на Button1,
$ ("# button2"). один ("щелчок", первый); - $ ("# button2"). One ("click", second);
В чем проблема с кодом? Это работает или что? –