javascript - Hashchange event -


so, there wrong hashchange... wont trigger

$('form').submit(function() {     var form_data = ($(this).serialize());     window.location.hash = form_data.replace('=','/');     return false; });  $(window).on('hashchange', function () {     var values = window.location.hash.slice(1).split('/');     $("[name=" + values[0] + "]").val(values[1]); } 

you missing closing ); @ end of second event handler assigment.

$(window).on('hashchange', function () {     '...'; }); //<= here had } 

other that, seems work fine. unless using ie7 of course, not support onhashchange (browser support).


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -