2

jQueryを使用してDiv内にテキストとasp:ボタンを追加したいと思います。

コード:

Hi,  <p> Are you sure you want to go ahead</p><p>Please ignore this warning if this is not the first time you are logging in</p>
<asp:button ID="btnProceed" runat="server" Text="Proceed"></asp:button>

実装:

jQ('#proceedDiv').append("<div> Hi,  <p> Are you sure you want to go ahead</p><p>Please ignore this warning if this is not the first time you are logging in</p> <asp:button ID="btnProceed" runat="server" Text="Proceed"></asp:button></div>");

しかし、期待されると言ってエラーが発生します'('

そのエラーは、ボタンコードが始まるところです。テキストだけで(ボタンコントロールではなく)、コードは正常に機能します。誰かが私がそれを修正するのを手伝ってもらえますか?

4

1 に答える 1

0

引用符をエスケープする必要があります...

<asp:button ID="btnProceed" runat="server" Text="Proceed">

なる必要がある

<asp:button ID=\"btnProceed\" runat=\"server\" Text=\"Proceed\">

また、

<button onclick="doSomething()">Click Me</button>
于 2014-06-03T19:50:13.867 に答える