0 votes
in Education by (1.7m points)
I tested out the script below in jsfiddle and it works fine, can someone guide me how to fix it? This is the url that I need it working in, the wizard style menu at the top right should should have each item set to active when clicked and then removed when another menu item is clicked: http://morxmedia.com/clients/temp/45p/index_vertical.html

Here is the code I am using for this:

    <script type="text/javascript">

      $('.wizard-steps div').click(function(e) {

            e.preventDefault();

            $('a').removeClass('active');

            $(this).addClass('active');

        });

    </script>

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.7m points)
You are binding the click event to div elements when you should bind them to a elements like so

$(document).ready(function(){

    $('.wizard-steps > div > a').click(function(e) {

        e.preventDefault();

        $('a').removeClass('active');

        $(this).addClass('active');

    });

});
...