Skip to content

Instantly share code, notes, and snippets.

@hanxiaomax
Created November 21, 2014 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanxiaomax/1b16b763e98d335b505b to your computer and use it in GitHub Desktop.
Save hanxiaomax/1b16b763e98d335b505b to your computer and use it in GitHub Desktop.
根据json创建动态表单
$(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