简体   繁体   中英

How to disable select tag in backbone.js

I want to disable my select option because is auto fill.
So the problem is that when I use readonly="readonly" and disable="disable" it changes into a disabled field but it sends null as value due to that my address is not updating. It's MVC template code, using backbone.js.

    <div class="login-register" data-validation="control">
      <select name="state123" id="state123" class="sumary state" disabled > 
        {{#each states}}
          <option value="{{code}}" {{#if selected}}selected{{/if}}>
            {{name}}
          </option>
        {{/each}}
      </select>
    </div>
<input type="hidden" name="state" id="state" class="cart-summary-estimate-input state" />

You haven't set the value of hidden input. It should be

<input type="hidden" name="state" value="{{code}}"/>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM