2015-04-16 103 views
0

我正在使用Skeleton,並且執行一個非常簡單的登錄頁面。如何使用Skeleton Boilerplate發送表單

我使用提供在其網站上的樣品(http://getskeleton.com/#forms)的形式風格:

<!-- The above form looks like this --> 
<form> 
    <div class="row"> 
    <div class="six columns"> 
     <label for="exampleEmailInput">Your email</label> 
     <input class="u-full-width" type="email" placeholder="[email protected]" id="exampleEmailInput"> 
    </div> 
    <div class="six columns"> 
     <label for="exampleRecipientInput">Reason for contacting</label> 
     <select class="u-full-width" id="exampleRecipientInput"> 
     <option value="Option 1">Questions</option> 
     <option value="Option 2">Admiration</option> 
     <option value="Option 3">Can I get your number?</option> 
     </select> 
    </div> 
    </div> 
    <label for="exampleMessage">Message</label> 
    <textarea class="u-full-width" placeholder="Hi Dave …" id="exampleMessage"></textarea> 
    <label class="example-send-yourself-copy"> 
    <input type="checkbox"> 
    <span class="label-body">Send a copy to yourself</span> 
    </label> 
    <input class="button-primary" type="submit" value="Submit"> 
</form> 

<!-- Always wrap checkbox and radio inputs in a label and use a <span class="label-body"> inside of it --> 

<!-- Note: The class .u-full-width is just a utility class shorthand for width: 100% --> 

但我沒有看到,我在那裏控制的形式發送到時提交。

有人可以解釋如何使用Skeleton發送表單嗎?

對不起,這個愚蠢的問題,但我迷路了。

感謝, Melvins的

回答

0

我相信,他們只是給你的佈局HTML和CSS。您需要爲表單元素提供一個action屬性(action ='myurl')或id(id ='myform')。這裏只是使用action屬性一個簡單的例子:

<p>Click 'Submit' to send the input name to 'myform.php'</p> 
 
<form action="myform.php"> 
 
    Name: <input type="text" name="name"> 
 
    <input type="submit"> 
 
</form>

更好,你可以使用jQuery或JavaScript建立一個事件處理程序,將檢測按鈕點擊併發送你的表單輸入數據無論你喜歡:

$("#myform").submit(function(event) { 
 
    alert("name data sent to myform.php"); 
 
    $.post("myform.php"); 
 
    event.preventDefault(); 
 
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> 
 
<p>Click 'Submit' to send the input name to 'myform.php'</p> 
 
    <form id="myform"> 
 
     Name: <input type="text" name="name"> 
 
     <input type="submit"> 
 
    </form>

相關問題