私は次のHTMLを持っています:
<a id="foo">Click Me</a>
<form action="" method="post">
<input type="submit" value="submit">
</form>
<script type="text/javascript">
$(function() {
$('#foo').click(function() {
alert('hello');
});
});
</script>
ご覧のとおり、送信ボタン (ページをリロードする) をクリックするまで、「クリックしてください」は正常に機能します。
フォームの送信後でも「クリックしてください」が期待どおりに機能するように、これを防ぐにはどうすればよいですか?
注: my の中身は次の<head>
とおりです。
<head>
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" />
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script src="http://code.jquery.com/mobile/latest/jquery.mobile.min.js"></script>
</head>
更新:削除してみました
<link rel="stylesheet" href="http://code.jquery.com/mobile/latest/jquery.mobile.min.css" />
タグ内head
では機能しますが、この CSS ファイルは Jquery Mobile の重要な部分です。