【发布时间】:2015-01-23 05:16:07
【问题描述】:
我正在使用单个表单进行 Jquery 移动应用程序。我在 textarea 中输入了一些文本,并在完全输入文本后用新名称重命名了提交按钮。第一次按下时表单没有提交。它唯一的提交,第二次我按提交按钮。但我需要在第一次按下时提交表单。从我的 Android 手机测试。这是代码,
<div id="pg_send-sms" data-role="page" data-add-back-btn="true">
<form name="frm_send-sms" id="frm_send-sms" action="" method="post">
<div data-role="header" data-position="fixed" data-theme='b'>
<h1 id='send-sms-header'></h1>
<a href="#pg_home" data-icon="home">Home</a>
<a href="" data-role='button' id="history_redirect" data-icon="grid">History</a>
</div>
<div data-role="content" id="pg_send-sms_content" class='center-wrapper'>
<div data-role="fieldcontain">
<label for="txt_msg_box" style="text-align: left;">Message</label>
<textarea name="txt_msg_box" class="txt_msg_box" id="txt_msg_box" placeholder="Type your message"></textarea>
</div>
<div data-role="fieldcontain">
<input type="submit" name="btn_send_submit" id="btn_send_submit" value="Send" data-theme='b' />
</div>
</div>
<div data-role="footer" data-position="fixed" data-theme='b'>
<h1 id="send-sms-footer"></h1>
</div>
</form>
</div>
sendsms.js
$( "#pg_send-sms" ).on( "pagecreate", function( event ) {
$('.txt_msg_box').change(changebuttonText);
});
function changebuttonText() {
$('#btn_send_submit').val("Message");
$('#btn_send_submit').button("refresh");
}
$("#btn_send_submit").click(function(e){
alert('button clicked');
return false;
});
【问题讨论】:
标签: jquery jquery-ui jquery-mobile