如果我想使用jquery-ui 1.12.0将两个图标添加到一个按钮,该怎么办?

时间:2017-08-05 06:54:41

标签: javascript jquery html css jquery-ui-button

  $("#search_button").button({
    icons: {
        "primary": 'ui-icon-search',
        "secondary": "ui-icon-triangle-1-s"
    },
});

"secondary": "ui-icon-triangle-1-s"无法添加到"#search_button"

1 个答案:

答案 0 :(得分:0)

您需要更新代码以使用新的jquery ui版本1.12.0

//旧

<button>Click me</button>

$( "button" ).button( {
    icons: {
        primary: "ui-icon-lock",
        secondary: "ui-icon-gear"
    }
} );

//在新的ui版本1.12.0中

<button>Click me <span class="ui-icon ui-icon-gear"></span></button>

$( "button" ).button( {
    icon: "ui-icon-lock"
} );

&#13;
&#13;
$("#search_button" ).button( {
    icon: "ui-icon-search"
});
&#13;
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

<button id="search_button">Search <span class="ui-icon ui-icon-triangle-1-s"></span></button>
&#13;
&#13;
&#13;