Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

dynamic select option dropdown in jquery

var temp = "myValue";

// Create New Option.
var newOption = $('<option>');
newOption.attr('value', temp).text(temp);

// Append that to the DropDownList.
$('#dptcentres_edit').append(newOption);

// Select the Option.
$("#dptcentres_edit > [value=" + temp + "]").attr("selected", "true");
 
PREVIOUS NEXT
Tagged: #dynamic #select #option #dropdown #jquery
ADD COMMENT
Topic
Name
4+5 =