1

I am doing a jQuery for hotel project. visibility hidden is not working when i come back from next page to previous page.

This is my code:

$("select#rooms").live("change",function() {
  if ($('select#rooms option:selected').val()==2) {
    $("#see1").css("visibility","visible");
  } else {
    $("#see1").css("visibility","hidden");
  }
});
thomthom
  • 2,854
  • 1
  • 23
  • 53
azarudeen ajees
  • 99
  • 1
  • 3
  • 9

1 Answers1

1

I believe on() is the new standard to use instead of live(). With regards to your issue, I believe most browsers do not preserve state when navigating back to a page. The only exception to this rule is Firefox. You could try adding an onready() handler to re-evaluate DOM objects on the page.

Dan Lister
  • 2,543
  • 1
  • 21
  • 36
  • can you plz give example or ellaborate your answer – azarudeen ajees Mar 15 '12 at 14:26
  • Try the below, referenced from http://stackoverflow.com/questions/158319/cross-browser-onload-event-and-the-back-button history.navigationMode = 'compatible'; $(document).ready(function() { alert('test'); }); – Dan Lister Mar 15 '12 at 15:44