c# .net Adsense ADO.NET Linq Viruses/security asp.net MVC JQuery Angular-js Node-js SEO Java C++ SQL API Networking vb.net .Net Css JavaScript Generics c#.Net entity framework HTML Website host Website Construction Guide HTTP tutorial W3C tutorial Web Services JSON Psychology Ionic framework Angular ReactJS Python Computer Android
JQuery

How to apply border over image for a particular div element using jQuery?

| | JQuery

In some situation we needed to apply border over the image for the particular div element id in jquery.We can set multiple css properties to border over image using jquery on pageload.

Example:

<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Animated borderover image using css</title>
     <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $('#firstdiv').find('img').css("border", "solid 2px #2e9fff");
        });
    </script>
    <style type="text/css">
        .rect {
            width: 350px;
            height: 79px;
            cursor: pointer;
            padding: 5px;
        }
    </style>
</head>
<body style="border: 1px solid #DED8D8; width: 500px; height: 300px">
    <h2 style="color: #FF5722;">apply border over image for aparticular div element</h2>
    <div id="firstdiv" class="box">
        <a href="http://www.infinetsoft.com/" title="header logo image">
            <img src="http://www.infinetsoft.com/Images/logoinfi.png" class="rect" alt="header logo">
        </a>
    </div>
    <div class="box">
        <a href="http://www.infinetsoft.com/" title="footer logo image">
            <img src="http://www.infinetsoft.com/Images/footer_logo1.png" class="rect" alt="footer logo">
        </a>
    </div>
</body>
</html> 

Output: