2017-07-21 6 views
0

私はプログラミングで新しいです、私のテキストエリアプレースホルダは表示されません。 私がここで見たすべての以前の答えは、テキスト領域の開始タグと終了タグの間にスペースや改行があってはならないことを説明しています。data-validation-required-messageは問題を作成していますか?どうすればこの問題を解決できますか? は、ここに私のコードです開始タグと終了タグの間にスペースや改行がないときにテキストエリアプレースホルダが表示されない

      <div class="col-md-6"> 
          <div class="form-group"> 
           <textarea class="form-control" placeholder="Your Message *" id="message" required data-validation-required-message="Please enter a message."></textarea> 
           <p class="help-block text-danger"></p> 
          </div> 

私は行く、私はすでに

+0

を表示するために使用される ''あなたはtooltip'はあなたのコードが正しい良いオプション –

+0

で使用できるように、テキストエリアにmessage'でを入力してください。 May be Be CSSでは、いくつかのプロパティがテキストエリアのプレースホルダーのフォントカラー用に定義されています。その理由から、プレースホルダは表示されない可能性があります。 –

答えて

0

をブロックされるのwaarningてきた私の質問をd​​ownvoteと

<textarea class="form-control" placeholder="Your Message *" id="message" required data-validation-required-message="Please enter a message."></textarea> 

しかし、私のためにそれ `sの仕事をしようとしないでください。 !:S

0

Sinppet

デモ:: https://reactiveraven.github.io/jqBootstrapValidation/

$(function() { 
 

 
       prettyPrint(); 
 

 
       $("input,textarea,select").jqBootstrapValidation(
 
        { 
 
         preventSubmit: true, 
 
         submitError: function($form, event, errors) { 
 
          // Here I do nothing, but you could do something like display 
 
          // the error messages to the user, log, etc. 
 
         }, 
 
         submitSuccess: function($form, event) { 
 
          alert("OK"); 
 
          event.preventDefault(); 
 
         }, 
 
         filter: function() { 
 
          return $(this).is(":visible"); 
 
         } 
 
        } 
 
       ); 
 

 
       $("a[data-toggle=\"tab\"]").click(function(e) { 
 
        e.preventDefault(); 
 
        $(this).tab("show"); 
 
       }); 
 

 
      });
 <link rel="stylesheet" href="https://reactiveraven.github.io/jqBootstrapValidation/css/prettify_bootstrap.css"> 
 
     <link rel="stylesheet" href="https://reactiveraven.github.io/jqBootstrapValidation/css/bootstrap.css"> 
 
     <script src="https://reactiveraven.github.io/jqBootstrapValidation/js/jQuery-1.7.2-min.js"></script> 
 
     <script src="https://reactiveraven.github.io/jqBootstrapValidation/js/bootstrap.js"></script> 
 
     <script src="https://reactiveraven.github.io/jqBootstrapValidation/js/prettify.js"></script> 
 
     <script src="https://reactiveraven.github.io/jqBootstrapValidation/js/jqBootstrapValidation.js"></script> 
 

 

 

 
<form class="form-horizontal" novalidate> 
 
         <div class="control-group"> 
 
          <label class="control-label" for="email">Email address</label> 
 
          <div class="controls"> 
 
           <input type="email" name="email" id="email" required> 
 
           <p class="help-block">Email address we can contact you on</p> 
 
          </div> 
 
         </div> 
 
         <div class="control-group"> 
 
          <label class="control-label" for="emailAgain">Email again</label> 
 
          <div class="controls"> 
 
           <input type="email" data-validation-matches-match="email" data-validation-matches-message="Must match email address entered above" id="emailAgain" name="emailAgain"> 
 
           <p class="help-block">And again, to check for speeling miskates</p> 
 
          </div> 
 
         </div> 
 
         <div class="control-group"> 
 
          <label class="control-label" for="terms-and-conditions">Legal</label> 
 
          <div class="controls"> 
 
           <label class="checkbox"> 
 
            <input type="checkbox" id="terms-and-conditions" name="terms-and-conditions" required data-validation-required-message="You must agree to the terms and conditions"> 
 
            I agree to the <a href="#">terms and conditions</a> 
 
           </label> 
 
           <p class="help-block"></p> 
 
          </div> 
 
         </div> 
 
         <div class="control-group"> 
 
          <label class="control-label">Quality Control</label> 
 
          <div class="controls"> 
 
           <label class="checkbox"> 
 
            <input type="checkbox" name="qualityControl[]" value="fast" data-validation-minchecked-minchecked="2" data-validation-minchecked-message="Choose two" data-validation-maxchecked-maxchecked="2" data-validation-maxchecked-message="You can't have it all ways" > 
 
            Fast 
 
           </label> 
 
           <label class="checkbox"> 
 
            <input type="checkbox" name="qualityControl[]" value="cheap"> 
 
            Cheap 
 
           </label> 
 
           <label class="checkbox"> 
 
            <input type="checkbox" name="qualityControl[]" value="good"> 
 
            Good 
 
           </label> 
 
           <p class="help-block"></p> 
 
          </div> 
 
         </div> 
 
         <div class="form-actions"> 
 
          <button type="submit" class="btn btn-primary">Test Validation <i class="icon-ok icon-white"></i></button><br /> 
 
          
 
         </div> 
 
        </form>

注:


今このメッセージを表示したい場合Please enter a message.次にJqueryを使用してこれを検証する必要があります。 Bcozそのdata-validation-required-messageその表示したいカスタム検証メッセージ

関連する問題