Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

請問驗證表單時,如何驗證下拉選單是否被選擇? #19

Open
wen09210 opened this issue Jul 25, 2017 · 1 comment
Open

Comments

@wen09210
Copy link

我試過了data-required=true
但好像沒什麼效果
請問是不是我驗證地方錯誤了呢?

郵遞區號:
								<div class="col-sm-3">
									<div data-role="district"
									 data-name="selArea"
									 data-value=""
									 data-style="form-control zip-group zip-state"
									 data-required="true" class="inline twziptwzip s2 has-feedback">
									</div>
									<span class="glyphicon form-control-feedback" aria-hidden="true"></span>
									<div class="help-block with-errors"></div>
								</div>
								<div class="col-sm-3">
									<div data-role="zipcode"
										data-name="zipcode"
										data-value="160"
										data-style="form-control" 
										class="twziptwzip has-feedback">
									</div>
									<span class="glyphicon form-control-feedback" aria-hidden="true"></span>
									<div class="help-block with-errors"></div>
								</div>
				</div>
@essoduke
Copy link
Owner

我記得目前是沒有支援 data-required 的。
現階段大概只能利用 js 去動態加入該屬性了:

$(selector).find('input').attr('required', true).prop('required', true);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants