Created
April 17, 2012 10:59
-
-
Save salieridk/2405304 to your computer and use it in GitHub Desktop.
Javascript: Add data from JSON to <select>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var options_departments = '<option>The first option goes here<\/option>'; | |
$.each(banks, function(i,x){ | |
options_departments += '<option value="' + x.name + '">' + x.name + '<\/option>'; | |
}); | |
$("select#divName", this).html(options_departments); | |
$("select#divName", this).change(function(){ | |
var index = $(this).get(0).selectedIndex; | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment