Javascript-форум (https://javascript.ru/forum/)
-   jQuery (https://javascript.ru/forum/jquery/)
-   -   one() не работает (https://javascript.ru/forum/jquery/28918-one-ne-rabotaet.html)

SweeT_BladE 07.06.2012 10:05

one() не работает
 
Здраствуйте, мне надо сделать, чтобы скрипт выполнялся только 1 раз.
нашел вроде неплохой способ.
Почему он может не работать? Спасибо
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml"  lang="ru">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="style.css" />
<script type="text/javascript" src="share42/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
$("body").one("click", function() {
  alert("This will be displayed only once.");
});
</script>
</head>
<body>

</body>
</html>

bot87 07.06.2012 10:17

<style>
body,html{height:100%;}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(e) {
    

$("body").one("click", function() {
  alert("This will be displayed only once.");
});

});
</script>

SweeT_BladE 07.06.2012 10:27

Спасибо, все работает


Часовой пояс GMT +3, время: 08:30.