We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 26069
    • 16 Posts
    Hi,

    I have a problem with an anchor link. I have a link:

    <a href="javascript:void(0);" id="information-link">Information Link</a>


    Then I have some jQuery that adds some functionality to that link:

    $('#information-link').click(function(e) {
    	$('#buynow-form-1').validate({
    		debug: true,
    		rules: {
    			users: {
    				required: true,
    				min: 1
    			}
    			},
    		messages: {
    			users: ''
    		}
    	});
    	if ($('#buynow-form-1').valid()) {
    		window.location.href = 'http://www.domain.com/buynow#step2';
    	}
    })
    .find('a') // make sure that link don't get clicked twice.
    .click(function(e) {
    	e.stopPropagation();
    });
    


    Then I have some other jQuery that will catch the hashchange and then run some functions.

    When I test this locally in a regular html-file it works fine but as soon as I put the code in MODx it fails. The big difference is that it in MODx the whole page is reloaded but in the local html-version the url is only changed (buynow.html -> buynow.html#step2).

    Any input?
      • 26069
      • 16 Posts
      Never mind, I just figured out the solution:

      window.location.hash = '#step2';


      smiley