Support the ongoing development of Laravel.io →
posted 10 years ago
Testing
Last updated 2 years ago.
0

no effort post?

post some code so we can help you, it's not hard.

Last updated 2 years ago.
0

$(function() { $('.nav-box').each( function() { var box = $(this); menu = box.children('.nav'); body = box.children('.nav-cont'); actbtn = box.find('.nav-act')

	$('.nav li').click( function() {
		var parent = $(this).parents('.nav');
			trigger = $(this).data('nav');
		    target = $('#wrapper').find(trigger);
        if (!$(this).hasClass('no-sel') && !$(this).parent().hasClass('no-sel')) {
            parent.find('li.sel').removeClass('sel');
            $(this).addClass('sel');
        };
		$(target).addClass('show').siblings('.show').removeClass('show');
	});

    $('.nav-act .next').click( function() {
        var currSel = body.children('.nav-item.show');
            menuSel = menu.children('.sel');
        $(currSel).removeClass('show').next('.nav-item').addClass('show');
        $(menuSel).removeClass('sel').next('li').addClass('sel');
    });
    $('.nav-act .prev').click( function() {
        var currSel = body.children('.nav-item.show');
            menuSel = menu.children('.sel');
        $(currSel).removeClass('show').prev('.nav-item').addClass('show');
        $(menuSel).removeClass('sel').prev('li').addClass('sel');
    });

    if (actbtn.length > 0) {
        $.fn.wizardSteps = function() {
            steps = body.children('.nav-item');
            if ($(steps).first().hasClass('show')) { actbtn.find('.prev').attr('disabled','disabled') } else { actbtn.find('.prev').attr('disabled', false) };
            if ($(steps).last().hasClass('show')) { actbtn.find('.next').attr('disabled','disabled') } else { actbtn.find('.next').attr('disabled', false) };
        };
        $.fn.wizardSteps();
        $('.nav li, .nav-act .next, .nav-act .prev').click( function() {
            $.fn.wizardSteps();
            menu.find('li.complete').removeClass('complete');
            menu.find('li.sel').prevAll().addClass('complete');
        });
    }
})

});

It's one part of a js file that's included in the header of my main.blade.php

Since it didn't work, I tried to include in in the body. I also tried to obfuscated the code just to try it out. I already gave up on this. No matter where I include this, It won't work.

Last updated 2 years ago.
0

I'm afraid I don't.

Last updated 2 years ago.
0

My first guess is that JQuery is probably being loaded near the end of your html document before the closing body tag. That's pretty standard practice anyway. Therefore if your example script is in the head of your document, then Jquery hasn't loaded yet, hence your problem.

However this doesn't account for the code working in a standard html document, unless you're not telling us the whole story.

Try moving your script to the very bottom of your html, right before the closing body tag and see if that works.

If the above is not correct, check the path to JQuery and make sure it is actually being loaded.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.