2013-09-23 11 views

उत्तर

1

यह एक देर से जवाब लेकिन वैसे भी हो सकता है: तुम सिर्फ जोड़ने एक आवश्यक करने के लिए चयन और एचटीएमएल 5 सत्यापन दिखाई देगा:

फिडल: http://jsfiddle.net/mksshhwt/

<form> 
required select2: <select class="select2" required multiple name="test"> 
    <option>Test</option> 
    <option>Test2</option> 
</select> 
    <br/> 

    required select2: <select class="select2" required name="test"> 
    <option>Test</option> 
    <option>Test2</option> 
</select> 

    <br/> 
<input type="submit" value="Test" /> 
</form> 

जे एस:

$(".select2").select2(); 

आपको शीर्ष पर थोड़ा सा सत्यापन मिल सकता है, इसे ठीक करने के लिए इस धागे का पालन करें: https://github.com/select2/select2/issues/128

0

मैं क्या किया था:

<select name="myselect" class="select2" required> 

और यह बहुत छोटी लेकिन "दृश्यमान" बनाने के लिए इतना HTML सत्यापन चेतावनी सामान्य रूप से दिखाई दे सकता है

select.select2{ 
    position: static !important; 
    outline:none !important; 
} 

और प्रारंभ Select2 कुछ सीएसएस कहा:

$(".select2").select2(); 
संबंधित मुद्दे