0

有没有人遇到过在 jquery-mobile 中使用文本输入类型时无法输入空格的问题

代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.0-beta.1/jquery.mobile-1.2.0-beta.1.min.js"></script>
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0-beta.1/jquery.mobile-1.2.0-beta.1.min.css"/>
    <link rel="stylesheet" type="text/css" href="mobile-css.css"/>
</head>
<body>
<div data-role="dialog" data-theme="d">
    <div data-role="header" data-theme="d"><h5 style="margin: 0.6em 10% 0.5em;">Comment</h5></div>
    <div id="" data-role="content" data-theme="d">
        <label for="txtComment">Your Comment:</label>
        <input type="text" id="txtComment" data-theme="d">
    </div>
    <div data-role="footer" data-theme="d">
        <a href="#" data-role="button" data-mini="true" data-inline="true" data-transition="fade"
           class="cancelButton" data-theme="c" data-rel="back">Cancel</a>
        <a href="#" data-role="button" id="btnSave" data-theme="d">Save</a>
    </div>
</div>
</body>
</html>
4

1 回答 1

0

试试这个简单的例子(在 iPhone 5 上测试),它使用目前最新版本的 jQuery Mobile(1.2.0),如果它有效,请告诉我:

<html>
<head>
    <meta name='viewport' content='minimum-scale=1.0, width=device-width, maximum-scale=1.0, user-scalable=no' />

    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile.structure-1.2.0.min.css" />
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>   

</head>

<body>

    <div data-role="page">
        <div data-role="header" data-position="fixed">
            <h1>HEADER</h1>
        </div>

        <div data-role="content">
            <h1>my content</h1>
            <input type="text"/>
            <a data-role="button" href="#mydialog" data-rel="dialog">OPEN DIALOG</a>
        </div>

        <div data-role="footer" data-position="fixed">
            <h1>FOOTER</h1>
        </div>
    </div>

    <!-- YOUR DIALOG -->
    <div data-role="dialog" data-theme="d" id="mydialog">
        <div data-role="header" data-theme="d">
            <h5 style="margin: 0.6em 10% 0.5em;">Comment</h5>
        </div>
        <div id="" data-role="content" data-theme="d">
            <label for="txtComment">Your Comment:</label>
            <input type="text" id="txtComment" data-theme="d">
        </div>
        <div data-role="footer" data-theme="d">
            <a href="#" data-role="button" data-mini="true" data-inline="true" data-transition="fade"
                class="cancelButton" data-theme="c" data-rel="back">Cancel</a>
            <a href="#" data-role="button" id="btnSave" data-theme="d">Save</a>
        </div>
    </div>

</body>
</html>


您应该得到以下信息:

1


尝试在输入文本框中输入空格:

2


然后,单击按钮OPEN DIALOG,这将引导您进入对话框(您提供的代码),并尝试在对话框的输入文本框中输入空格:

3

我希望这对你有用。不管怎样,让我知道你的结果伙伴。

于 2012-10-10T04:32:02.543 回答