jquery 点击省份出学校

exceptionHandle
yanxd 11 years ago
parent edce128e6b
commit 891fa65c16

@ -5,6 +5,8 @@
function(){ function(){
$("#province_lean").attr("href", "#WOpenWindow") $("#province_lean").attr("href", "#WOpenWindow")
$("#province_lean").leanModal({top: 100, closeButton: ".modal_close"}); $("#province_lean").leanModal({top: 100, closeButton: ".modal_close"});
$("#province option").attr("disabled", true);
$("#province option").click(function(){get_options(this.value);});
} }
); );
</script> </script>
@ -19,10 +21,10 @@
url :'/school/get_options/'+encodeURIComponent(value), url :'/school/get_options/'+encodeURIComponent(value),
data :'text', data :'text',
success: function(data){ success: function(data){
$("#schoollist").html(data); $("#schoollist").html(data);
},
complete: function() {
$("#province option").attr("disabled", true);
} }
} }
@ -117,7 +119,7 @@
<input id="occupation_name" type="text" value="<%=User.current.user_extensions.school.name%>" readonly /> <input id="occupation_name" type="text" value="<%=User.current.user_extensions.school.name%>" readonly />
<% else %> <% else %>
<%= l(:field_occupation) %>&nbsp;<span class="required">*</span><%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), :onchange => "get_options(this.value)" %> <%= l(:field_occupation) %>&nbsp;<span class="required">*</span><%= select_tag "province", options_from_collection_for_select(School.find_by_sql("select distinct province from schools"), :province, :province), onclick: '$("#province option").attr("disabled", false)' %>
<input id="occupation" name="occupation" type="hidden" /> <input id="occupation" name="occupation" type="hidden" />
<input id="occupation_name" type="text" readonly /> <input id="occupation_name" type="text" readonly />

Loading…
Cancel
Save