2012-04-28 79 views
0

我使用jQuery手機來製作一個網站,由於某種原因,它不會讓我把文本框和按鈕放在同一行上。jquery移動樣式問題

<div data-role="footer" data-position="fixed"> 
      <input type="text" placeholder="Your Message" id="usermsg" /><input type="button" value="Send!" id="submitmsg" /> 
</div> 
+0

我已經嘗試調整文本框的大小來爲按鈕騰出空間,但那不起作用。 – 2012-04-28 14:41:24

+0

沒關係。我想到了。 – 2012-04-28 14:57:38

回答

0

使用網格是這樣做的正確方法。

<label for="points">Textbox and a Button on the same line.</label> 
    <div data-role="footer" data-position="fixed"> 
    <div class="ui-grid-a"> 
     <div class="ui-block-a"> 
      <input type="text" data-inline="true" placeholder="Your Message" id="usermsg" /> 
     </div> 
    <div class="ui-block-b"> 
      <input type="button" value="Send!" id="submitmsg" data-inline="true"/> 
    </div> 
    </div> 

如果你想改變網格大小,你可以簡單地添加一些CSS到它。例如。 class="ui-block-a myField" 也作爲一個快速的建議,我會推薦遠離在JQuery Mobile中使用ID,因爲AJAX導航。建議使用類來代替。