私はJavaScriptに関する経験がありますが、jQueryに関しては完全なnoobです。基本的には、実際の単純なクリックイベントハンドラを追加して時間を返そうとしています。私はコンソールに何のエラーも受けていませんが、ボタンをクリックしても何も起こりません(テスト目的でconsole.logを追加しました)。ブートストラップパッケージ全体をnugetでインポートしたので、完全なjQueryライブラリがあると思います。私は行方不明の何か他にありますか?前もって感謝します!初心者のjQueryの問題
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="jQuery.aspx.cs" Inherits="garrettPenfieldUnit10.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="server">
<h1>jQuery Page</h1>
<p><asp:Label ID="LabelJQ" runat="server" Text="Click the Button!"></asp:Label></P>
<asp:Button ID="ButtonJQ" runat="server" Text="Update the Time!"/>
<script src="Scripts/jquery-1.9.1.js"></script>
<script type="text/javascript">
$('#ButtonJQ').click(function() {
var d = new Date();
document.getElementById(LabelJQ).innerHTML = d.toLocaleTimeString();
console.log('wubba lubba dub dub!');
});
</script>
</asp:Content>
です。 – ibubi
@ibubi:私はASP.Netの 'Button'についてよく知らない。 :-)それが '
ありがとうございます! IDではなくクラスを処理するようにコードを変更しましたが、残念ながら私はまだ同じ結果を得ています。 –