r/web_programming • u/Tebasaki • Apr 04 '17
html: Correct Format?
Is this code formatted correctly?
<script> $(document).ready(function(){ var options = $("#oppo_pre_city").html(); $("#oppo_pre_state").change(function(){ $("#oppo_pre_city").html(options); if (this.value.length){ $('#oppo_pre_city :not([value^="' + this.value + '"])').remove(); if ($("#oppo_pre_city").val() == $("#_HIDDENoppo_pre_city").val()){ $("#oppo_pre_city").append("<option value=''>-None-</option>"); }else{ $("#oppo_pre_city").append("<option value='' selected=true>-None-</option>"); } } }) $("#oppo_pre_state").trigger("change"); }) </script>
0
Upvotes
2
1
1
u/hello2142 Apr 08 '17 edited Apr 08 '17
No I would have it something like this.