replace select option values - Jquery

change select option

Snippet Code


  
Rate this page :
  [ 0 votes]

you change/replace select option values using,

var changeOptions = {"Option 1": "Value 1", "Option 2": "Value 2", "Option 3": "Value 3"}; var $selId = $("#ansch"); $selId.empty(); $.each(changeOptions, function(key, value) { $selId.append($("<option></option>").attr("value", value).text(value)); });

Tags


Ask Questions

Ask Question