[英]Jquery-UI button icon without text
I want use jquery-ui button with text on them. 我想使用带有文本的jquery-ui按钮。 I am using the HTML javascript jquery-ui code below, but the icons display without any text on the button, only when I hold the mouse button on it, it displays the included text. 我正在使用下面的HTML javascript jquery-ui代码,但是图标显示的按钮上没有任何文本,只有当我按住鼠标按钮时,它才会显示包含的文本。 How can I fix it so I can have the text displayed next to the icons. 我该如何解决它,以便可以在图标旁边显示文本。
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Button - Icons</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<script>
$(function() {
$( "#but1" ).button({
icons: {
primary: "ui-icon-locked"
},
text: false
});
$( "#but2" ).button({
icons: {
primary: "ui-icon-clock"
},
text: false
});
});
</script>
</head>
<body>
<button id="but1" value="Rest">Button with icon only</button>
<button id="but2" value="Rest">Button with icon only</button>
</body>
</html>
Text is not displayed because you have written 因为您已经写过,所以不会显示文字
$( "#but1" ).button({
icons:{
primary: "ui-icon-clock"
},
text: false
});
try below code 尝试下面的代码
$("#but1").button({
icons: { secondary: "ui-icon-locked" }
});
it will display both text and icon. 它将同时显示文本和图标。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.