jQuery mobile,不需要的div出现在表单中 [英] jQuery mobile, Unwanted div appears inside form

查看:85
本文介绍了jQuery mobile,不需要的div出现在表单中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,为什么另一个div出现在我的提交"按钮的前面,并且请注意该div还是一个按钮,但是单击时却没有任何作用.但是,如果单击我的提交按钮,它将起作用,并且div将消失,但是如果刷新页面,它将再次出现.

My question is why another div appears right infront of my submit button, and note that this div acts as a button aswell, but it doesn't do anything when clicked. However if you click my submit button it will function and the div will disappear, but if you refresh the page it will reappear again.

<form method="post" action="newsfeed.php">
    <p>
      <label for="input1">Rubrik:</label><br>
      <input id="input1" class="text" type="text" name="rubrik">
    </p>
    <p>

    <label for="textarea-a">Message:</label>
    <textarea name="textarea" id="textarea-a" width="550px">
    </textarea></p>
        <input type="submit" name="doSave" value="Send" ></input>
</form>

我不知道出什么问题了.我通过网络浏览器检查了该元素,发现jquery mobile将我的代码翻译成了

I have no clue what is wrong. I inspected the element through my webrowser and found that jquery mobile translated my code to this

<form action="newsfeed.php" method="post">

    <p></p>
    <p>
        <label class="ui-input-text" for="textarea-a"></label>
        <textarea id="textarea-a" class="ui-input-text ui-body-a ui-corner-all ui-shadow-inset" width="550px" name="textarea"></textarea>
    </p>
    <div class="ui-submit ui-btn ui-shadow ui-btn-corner-all ui-btn-up-a" data-corners="true" data-shadow="true" data-iconshadow="true" data-wrapperels="span" data-theme="a" data-disabled="false" aria-disabled="false">
        <span class="ui-btn-inner"></span>
        <div class="ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-a">
            <input class="ui-btn-hidden ui-input-text ui-body-a" type="submit" value="Send" name="doSave" data-disabled="false"></input>
        </div>
    </div>

因此它将创建两个额外的div和一个跨度.有办法解决这个问题吗?

So it creates two extra divs and one span. Is there a way to fix this?

谢谢您的帮助.

推荐答案

jQuery Mobile在页面加载时转换表单输入(除其他外)以使其成为移动友好版本.通常这是需要的,因为按钮的jQuery移动版本更易于单击.如果您不希望这样,请将data-role ="none"属性添加到您的提交输入中,如下所示:

Jquery Mobile converts form inputs (among other things) on page load to make a mobile friendly version of it. Usually this is desired, as buttons are easier to click with the jquery mobile version of it. If you do not want this add the data-role="none" attribute to your submit input like this:

<input type="submit" data-role="none" name="doSave" value="Send" ></input>   

这篇关于jQuery mobile,不需要的div出现在表单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆