2014-12-04 4 views
0

양식 필드에 공백이 있으면이 공백을 선택하여 삭제하면 미리 채워진 텍스트가 다시 표시됩니다. 나는 이것을 어떻게 만들지 모르며 하루 종일 쏘는 데 어려움을 겪고 있습니다. 어떤 아이디어? 여기에 내 코드가 있습니다 ...양식 필드에 공백이 있습니다.

<?php 
include '_include/php/header.php'; 
#set variables to be used in the header 
$page_title = "Assesment"; 
?> 
<div class="page" id="subheader"> 
    <div class="container"> 
     <!-- Title Page --> 
     <div class="row"> 
      <div class="span12"> 
       <div class="title-page"> 
        <h2 class="title">Four simple steps...</h2> 
        <h3 class="title-description">To dictate what you need 
        in a website</h3> 
       </div> 
      </div> 
      </div><!-- End Title Page --> 
      <!-- submenu --> 
      <?php 
      include '_include/php/submenu.php'; ?> 
     </div> 
     </div><!-- End sub header --> 
     <!-- main Section --> 
     <div class="page" id="contact"> 
      <div class="container"> 
       <!-- Title Page --> 
       <div class="row"> 
        <div class="span12"> 
         <div class="title-page"> 
          <h2 class="title">Assesment - Step One</h2> 
          <h3 class="title-description">Status: <span class= 
          "color-text"><?php echo $assessresult; ?></span></h3> 
         </div> 
        </div> 
        </div><!-- End Title Page --> 
        <!-- main Form --> 
        <div class="row"> 
         <div class="span9"> 
          <form action="assessment_submitted.php" class="contact-form" id="contact-form" 
           method="post" name="contact-form"> 
           <h3 class="color-text">What do you wish to get out of 
           your website?</h3> 
           <p class="contact-message"> 
           <textarea required cols="10" id="client-goals" name= 
           "client-goals" placeholder= 
           "What do you wish to acheive by having a website? ie. creating a web presence, expanding sales by creating an online market, networking, ect." 
           rows="5"> 
           </textarea></p> 
           <h3 class="color-text">What key fatures are you looking 
           for?</h3> 
           <p class="contact-message"> 
           <textarea required cols="10" id="client-needs" name= 
           "client-needs" placeholder= 
           "What key features are you looking to have within your website? ie. storefront, social media intigrtion, a blogging platform, content managment system, ect." 
           rows="5"> 
           </textarea></p> 
           <script type = "text/javascript" > 
           var i = 1; 

          function addUrl() { 
            if (i < 3) { 
             i++; 
             var p = document.createElement('p'); 
             p.innerHTML = 
              '<hr><textarea required id="client-needs" placeholder="Add URL #' + i + 
              '" name="example' + i + 
              '" rows="1" cols="10"><\/textarea><input type="button" value="Remove added URL" onclick="removeUrl(this)">'; 
             document.getElementById('example').appendChild(p); 
            } //END if 
           } //END addUrl function 

          function removeUrl(textarea) { 
            textarea.parentNode.parentNode.removeChild(textarea.parentNode); 
            i--; 
           } //END removeUrl function 
           </script> 
           <h3 class="color-text">Do you have and examples of what 
           you want?</h3> 
           <p class="contact-message" id="example"> 
           <textarea cols="10" id="examples" name="example1" 
           placeholder="Do you know of any website like the one you want? ie. google.com, p5services.com, youtube.com" 
           rows="1"> 
           </textarea></p><br> 
           <input onclick="addUrl()" type="button" value= 
           "Add url example"> 
           <h3 class="color-text">Do you have a budget in 
           mind?</h3> 
           <p class="contact-message"> 
           <textarea required cols="10" id="client-budget" name= 
           "client-budget" placeholder= 
           "Enter a budget, approximate or exact. This will help us decide if the scope of your project is in line with what you are interested in spending" 
           rows="2"> 
           </textarea></p> 
           <h3 class="color-text">Do you have a timeline or 
           deadline?</h3> 
           <p class="contact-message"> 
           <!-- <textarea id="client-deadline" placeholder="When do you need this done by?" name="client-deadline" rows="2" cols="10"></textarea> --> 
           <!-- <input id="client-deadline" name="client-deadline" 
           type="date"></p> --> 
           <!-- add a call to action for further services later --> 
           <h3 class="color-text">Any other comments?</h3> 
           <p class="contact-message"> 
           <textarea cols="10" id="client-comments" name= 
           "client-comments" placeholder= 
           "Don't let us over look anything!" rows="5"> 
           </textarea></p> 
           <p class="contact-submit"><input name= 
           "submit_assessment" type="submit" value= 
           "Save New Record"></p> 
           <div id="response"></div> 
          </form> 
         </div> 
         <div class="span3"> 
          <div class="contact-details"> 
           <h3><span class="font-icon-info"></span> Assesment 
           Objective</h3> 
           <p>The assesment section is used to define your needs 
           and help us decided what tool we need to impliment in 
           order to help you reach your goals</p> 
           <h4 class="color-text">After submitting this you will 
           recive a quote!</h4> 
          </div> 
         </div> 
         </div><!-- End main Form --> 
        </div> 
        </div><!-- End main Section --> 
        <?php 
        include '_include/php/footer.php'; ?> 
+0

사이의 줄 바꿈으로 인해 발생보고 삭제 한 후보고 된 공간 모든 코드를 *관련된*? 아니면 양식을 볼 필요가 있습니까? – James

+0

@James 주석은 정말로 질문이 아니어야하며, 힌트로만 생각되었다고 생각합니다. 문제를 설명하는 최소 관련 코드 만 게시하십시오. – charlietfl

+0

@charlietfl 그래서 관련 질문을 위해 새 스레드를 열 것을 제안합니다. ? 나는 의견을 공유하지 않는다. "코멘트는 정말로 질문이 아니어야한다"_. – carlodurso

답변

3

textarea 요소는 다른 형식의 자리 표시 자 텍스트를 사용합니다. 당신과 같이 태그 사이에 넣어해야합니다

<textarea>My text area placeholder text goes here</textarea> 

당신이 당신의 자리 당신의 개폐 텍스트 영역 태그

+1

감사합니다. 나는 그것이 문제가 될 것으로 의심했지만 줄 바꿈을 제거 할 때 자리 표시자를 떠나 많은 문제를 남겼습니다. – hunt4car

관련 문제