創建一個取消按鈕我有以下引導標記:如何引導
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="username">Username</label>
<div class="col-md-4">
<input id="username" name="username" type="text" placeholder="" class="form-control input-md" required="" maxlength="8" value="">
</div>
</div>
<!-- Button (Double) -->
<div class="form-group">
<label class="col-md-4 control-label" for="submit"></label>
<div class="col-md-8">
<button id="submit" name="submit" class="btn btn-primary" value="1">Create Profile</button>
<button id="cancel" name="cancel" class="btn btn-default" value="1">Cancel</button>
</div>
</div>
當我點擊Create Profile
按鈕的形式工作正常讓我知道,某些字段是「必需的」。但是當我點擊Cancel
按鈕時,由於不完整的必填字段,我無法離開表單。
Bootstrap中是否有表單取消按鈕功能?
什麼ü留下的形式是什麼意思? ü可能需要編寫你自己的JS按鈕的邏輯,檢查這個http://stackoverflow.com/questions/18407832/how-to-create-a-simple-html-cancel-button –
爲什麼你不只是做表單外的按鈕?表單外的取消按鈕可以充當「後退」按鈕。 –
實際上,根據@ NaturalLam鏈接到另一個SO問題,我只是將'onclick =「window.location ='http://example.com';返回false;」'屬性添加到按鈕標記並獲得了期望的結果。謝謝。 –