💥 All the different visitor's actions that a web page can respond to are called events.
💥 An event represents the precise moment when something happens.
Examples:
- moving a mouse over an element
$(document).ready(function(){
$("p").on({
mouseenter: function(){
$(this).css("background-color", "lightgray");
},
mouseleave: function(){
$(this).css("background-color", "lightblue");
},
click: function(){
$(this).css("background-color", "yellow");
}
});
});
</script>
- selecting a radio button
$(document).ready(function(){
$("input").keypress(function(){
$(this).hide();
});
});
</script>
- clicking on an element
- 💧<script>
$(document).ready(function(){
$("p").on("click", function(){
$(this).hide();
});
});
</script>
No comments:
Post a Comment