Event mouseover and onclick event for the same set of elements

Asked

Viewed 19 times

1

Guys, how can I make my mouseover and click, work for a set of elements, in my case an img and two Labels:

Image Test

<style>
    .imgImportacao{
        width: 150px;
        margin-top: 10px;
        margin-left: 700px;
        position: absolute;
    }

    .mudarmouse{
        cursor: pointer;
    }

    .container{
        position: relative;
    }

    .texto1{
        position:absolute;
        font-size: 40px;
        left: 755px;
        top:35px;
        color: white;
    }

    .texto2{
        position:absolute;
        font-size: 20px;
        left: 722px;
        top:95px;
        color: white;
    }

</style>

14 Contributors

    <script>


            $(document).ready(function() {
                $("#testeimg").click(function(){

                alert("teste");

                }); 
            });


    </script>

  • work with classes, and add the same class to the elementros you want to have the same event...

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.