Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<style>
div.container {
width: 300px;
border: 1px solid;
}
div.box {
width: 150px;
border: 3px solid red;
float: left;
padding: 10px;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<div class="box" id="box1">BOX1.</div>
<div class="box" id="box2">BOX2.</div>
<div style="clear:both;"></div>
</div>
<script>
$(document).ready(function () {
$("#box1").mouseenter(function () {
$("#box1").css("background-color", "grey");
});
$("#box1").mouseleave(function () {
$("#box1").css("background-color", "white");
});
$("#box2").mouseenter(function () {
$("#box2").css("background-color", "grey");
});
$("#box2").mouseleave(function () {
$("#box2").css("background-color", "white");
});
$(".box").click(function(){
alert("Hello!");
});
});
</script>
</body>
</html>
The most helpful JQUERY solutions
plugin get client ip address using jqueryJQUERY Click to see more ... 10.4K 1.8K