0
我已經集成了bootstrap-wysihtml5
編輯器來描述部分在我的Rails應用程序。現在我想添加客戶端驗證,以便驗證描述字段的存在。我用bootstrap-wysihtml5-rails寶石。提前如何添加前端驗證在引導-wysihtml5護欄
<script type="text/javascript">
$(document).ready(function(){
$('#description').each(function(i, elem) {
$(elem).wysihtml5({
toolbar: {
"fa": true, // use Font Awesome
"font-styles": false, // Font styling, e.g. h1, h2, etc.
"emphasis": true, // Italics, bold, etc.
"lists": false, // (Un)ordered lists, e.g. Bullets, Numbers.
"html": false, // Button which allows you to edit the generated HTML.
"link": true, // Button to insert a link.
"image": true, // Button to insert an image.
"color": false, // Button to change color of font
"blockquote": false // Blockquote
}
});
});
})
感謝:
編輯器正在初始化與下面的代碼。
的建議,如果你想只使用最大和最小count..you可以使用HTML ... – Milind
提供的默認maxlenght和minlenght對不起找到了解決辦法,但那不適合我。 – SujitS
你可以嘗試jquery.validate js,並在你想要的任何字段上設置驗證....參考http://jqueryvalidation.org/documentation/ – Milind