Skip to content Skip to sidebar Skip to footer

Keep Value In City Drop Down List(part 4)

Cont. from Get state name from drop down list after click submit button (part 3) State data json ($stateJsonObject) Array ( [0] => stdClass Object ( [stateId] => s1 [stateN

Solution 1:

You may use either of following options,

  • Use AJAX to submit the form. Then the page will not be reloaded and you can keep the value unchanged.

  • Use HTML5 local storage (or cookies) to keep track of the city name that should be selected. When page loads, check if the value for city is saved and if saved, set the select to the saved value.

Post a Comment for "Keep Value In City Drop Down List(part 4)"