forum

Home / DeveloperSection / Forums / How to open page use $(this) in JQuery?

How to open page use $(this) in JQuery?

marcel ethan179504-Oct-2014

Here I'm testing to see if I can click on the anchor with the id '#slide-1285' and log it to the console. It always says 'not testing'. I'm going to set up conditions for all id's so a user is redirected to the correct page. Something like this:

<script>
    $('#slidernavigation > a').on('click', function(e){
        e.preventDefault();
        $(this).showSlide();
        if($a.id == $('#slide-1285')){
            window.location.href = http://webpage1;
        }
        elseif($a.id == $('#slide-1286')){
            window.location.href = "http://webpage2";
        }          
        elseif($a.id == $('#slide-1287')){
            window.location.href = "http://webpage3";
        }       else($a.id == $('#slide-1288')){
        window.location.href = "http://webpage4";
    }               });
</script>


Updated on 04-Oct-2014

Can you answer this question?


Answer

1 Answers

Liked By