<html>
<head>
<title>bind() event example</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#b1").click(function(){
$(".one").text("This is Div Content");
$(".one").bind("mouseover",function(){
alert("sdhfj");
});
});
$("#b2").click(function(){
$(".one").unbind("mouseover");
$(".one").text("jquery remove now");
});
});
</script>
<style>
.one
{
width:200px;
height:100px;
background-color:red;
color:#fff;
}
</style>
</head>
<body>
<input type="button" id="b1" value="Start"/>
<input type="button" id="b2" value="Stop"/>
<div class="one">
</div>
</body>
</html>
<head>
<title>bind() event example</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#b1").click(function(){
$(".one").text("This is Div Content");
$(".one").bind("mouseover",function(){
alert("sdhfj");
});
});
$("#b2").click(function(){
$(".one").unbind("mouseover");
$(".one").text("jquery remove now");
});
});
</script>
<style>
.one
{
width:200px;
height:100px;
background-color:red;
color:#fff;
}
</style>
</head>
<body>
<input type="button" id="b1" value="Start"/>
<input type="button" id="b2" value="Stop"/>
<div class="one">
</div>
</body>
</html>
0 comments:
Post a Comment