2016-03-22 11 views
0

ドロップダウンメニューリストを検証し、ユーザーがnot nullオプションを選択したかどうかを確認します。jqueryとtoolpisterを使用して選択オプションを検証する方法

$('#rappelform input[type="text"]').tooltipster({ 
    trigger: 'custom', // default is 'hover' which is no good here 
    onlyOne: false, // allow multiple tips to be open at a time 
    position: 'right' // display the tips to the right of the element 
}); 
$('#rappelform input[type="select"]').tooltipster({ 
    trigger: 'custom', // default is 'hover' which is no good here 
    onlyOne: false, // allow multiple tips to be open at a time 
    position: 'right' // display the tips to the right of the element 
}); 

そして、私のHTMLマークアップ: これは私のコードである

<select id="message" name="message[centre]" class="textbox"> 
    <option value="">choose value </option>  
    <option value="abc">select 1 </option> 
    <option value="abc">select 2 </option> 
</select> 

入力テキストの場合、私は問題ありませんが、選択オプションを使用して、私はメッセージを表示したいですユーザーがオプションを選択しない場合

答えて

0

なぜrequired属性を使用しないでください。

<form> 
 
<select id="message" name="message[centre]" class="textbox" required> 
 
    <option value="">choose value </option>  
 
    <option value="abc">select 1 </option> 
 
    <option value="abc">select 2 </option> 
 
</select> 
 
<input type="submit" value="Submit"/> 
 
</form>

+0

私はこのコードが正しい$( '#のrappelform入力[タイプ= "選択"]')であれば、私は尋ねる、jqueryのを使用して、それを検証する。tooltipste –

関連する問題