Sale is live! Enjoy 70% Off! Use Credit/Debit Cards in India and PayPal outside of India for better experience!

How to make div clickable


It can be done using jQuery click event and window.location.href function. Click event will be fired when user click on div then redirect function will redirect the page to specified link.

Source Code:

<!DOCTYPE html>
<html>
    <head>
        <title>How to make div clickable - jQuery | MG Technologies</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script src="jquery-1.js" type="text/javascript"></script>
        <script>
            $(document).ready(function(){
                $(".clickable").click(function(){
                    alert("Div is clicked! Now it will redirect to home page");
                    window.location.href = "https://www.mgtechnologies.co.in/";
                });
            });
        </script>
    </head>
    <body>
        <h2>Clickable div using jQuery</h2>
        <div class="clickable">I'm a DIV linked with home page. Click me to see that.</div>
    </body>
</html>

Free - Download it right now!


Tested

Include all files

Demo Download

Reviews and Comments