2012-07-10 82 views
0
@using (var form = Html.BeginForm("SearchCustomer","Home")){ 
@Html.ValidationSummary(true) 
<table> 
    <tr> 
     <td> 
      @Html.EditorFor(m => Model.SearchString) 
     </td> 
     <td> 

     </td> 
     <td> 
       <input type="submit" name="foo" data-role="none" /> 
     </td> 
    </tr> 
</table> 

} 
@using (var form = Html.BeginForm("SearchCustomer","Home")){ 
@Html.ValidationSummary(true) 
<table> 
    <tr> 
     <td> 
      @Html.EditorFor(m => Model.SearchString) 
     </td> 
     <td> 

     </td> 
     <td> 
       <input type="submit" name="foo" data-role="none" /> 
     </td> 
    </tr> 
</table> 

} 

我希望输入是jQuery手机样式,但如果我将数据角色设置为“按钮”,则页面为空。我能做什么?jQuery手机:输入不在jquery手机样式

回答

1

从jQuery移动文档:

为了易于造型,该框架的任何按钮或输入元件自动转换与类型提交,复位,按钮或图像到定制风格按钮 - 有不需要添加data-role =“button”属性。然而,如果需要的话,您可以直接调用按钮插件上的任何选择,就像任何jQuery插件:

$('[type='submit']').button();

为了保持绑定到原来的按钮或输入事件,框架通过使隐藏的原始元素它透明并将其放置在新的按钮标记上。当用户点击自定义样式的按钮时,他们实际上点击了原始元素。 若要防止将表单按钮转换为增强型按钮,请添加data-role =“none”属性,本地控件将呈现