Created
November 21, 2014 05:57
-
-
Save hanxiaomax/1b16b763e98d335b505b to your computer and use it in GitHub Desktop.
根据json创建动态表单
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
$(function(){ | |
$("input:radio").change(function(){ | |
var selectedvalue = $("input[name='group']:checked").val(); | |
$.getJSON("/static/select.json",function(data){ | |
$("#apply").empty(); | |
$.each(data,function() { | |
if (this.catagory==selectedvalue) | |
{ | |
$.each(this.subcatagory, function() { | |
$("#apply").append("<option>" + this.name + "</option>"); | |
}); | |
}; | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment