有人可以解释为什么按钮的图标不会显示在 Button1 和 Button3 中吗?Button1 是 asp:button,Button2 是 Button 类型,而 Button3 是 HTML 按钮。如何让图标显示在所有 3 个按钮上?
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<script type="text/javascript">
$(document).ready(function () {
$("[id$=Button1]").click(function () {
alert("Welcome button1 !");
});
$("[id$=Button2]").click(function () {
alert("Welcome button2 !");
});
$("[id$=Button3]").click(function () {
alert("Welcome button3 !");
});
$("[id$=Button1]").button({
icons:
{
primary: "ui-icon-search"
}
});
$("[id$=Button2]").button({
icons:
{
primary: "ui-icon-search"
}
});
$("[id$=Button3]").button({
icons:
{
primary: "ui-icon-search"
}
});
});
</script>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:Button ID="Button1" runat="server" Text="Button1" />
<button id="Button2">Button2</button>
<input id="Button3" type="button" value="Button3"></input>
</asp:Content>