jQuery AJAXで別のページからボタンを受け取ったページを作成しましたが、このボタンをクリックしても何も起こりません。コード:jQueryでDOMの要素を選択できません
$(function() {
//$("#Menu ul li").click(function() { alert("ok"); });
$("a").button();
$("#Menu ul li:nth-child(2)").click(function() {
$("#ajaxLoader").fadeIn('slow');
$.ajax({
url: "CreateDataBase.htm",
type: "GET",
dataType: "html",
success: function (data) {
$("#ajaxLoader").fadeOut('slow');
$("#Sample").html("").append(data).css("textAlign", "center").css("paddingTop","30px") ;
$("a").button();
}
});
});
$("#Sample input:submit").click(function() { alert("Ok"); });
});
createdbのページ:
<a id="CreateDB">Create a Database</a>
また、私はjQueryのUIを使用しています。 code in snipt.org
バインディングを実行するときにボタンは存在しますか?そうでない場合は、デリゲートする(ドキュメントを読む)on()のバージョンを使用するか、イベントをボタンにバインドしてからDOMに挿入する必要があります。 – Corbin
「*別のページからボタンを受け取りますか?」とはどういう意味ですか?どのクリックを参照していますか?ここでは3つのクリックハンドラがあります。 – Joseph