jQuery Event get current element

Description

jQuery Event get current element

View in separate window

<!DOCTYPE html>
<html lang="en">
<head>
<title>Select the Child Inside an Element in jQuery</title>
<style>
    .box{// w  w w  .  j av a 2 s.c  om
        padding: 80px;
        border: 10px solid #999;
        text-align: center;
    }
    .box img{
        width: 400px;
        border: 6px solid #999;
    }
</style>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
$(document).ready(function(){
    $(".box").click(function(){
        $(this).find("img").css("border-color", "blue");
    });
});
</script>
</head>
<body>
    <div class="box">
        <img src="image1.png" alt="circle">
    </div>
</body>
</html>



PreviousNext

Related