mzzxx11
mzzxx11

Reputation: 15

jquery ui button not working

I've followed the jquery ui demos and checked previous question on SO, but cant see why my code isnt working. Im trying to use the jquery ui button to layout button. In this simple example I just want to erase the button label:

<!DOCTYPE HTML>  

<html>  

<head>  
<script type="text/javascript" src="jquery-1.9.1.min.js"></script>  
<script type="text/javascript" src="jquery-ui.js"></script>  
</head>  

<body>  
<button type="button" id="b111">a</button>  
<script type="text/javascript">  
$(document).ready(function(){  
    $("#b111").button( {  
        text: false 
    } );  
});  
</script>  
</body>  

</html>  

Upvotes: 0

Views: 2804

Answers (2)

MasNotsram
MasNotsram

Reputation: 2273

For you to use the 'text' boolean, you need to be using the icons option:

http://api.jqueryui.com/button/#option-icons

Seems like a weird thing to do though.

You can remove the 'a' from the HTML itself, and the button will have no text. However, if you wish to keep the size, but simply hide the text, then just do it in CSS:

#b111 * {
    visibility:hidden;
}

Upvotes: 0

Simon C
Simon C

Reputation: 9508

From the jQuery UI documentation:

When set to false no text will be displayed, but the icons option must be enabled, otherwise the text option will be ignored.

So you can only say text: false if you have set an icon to display:

$("#b111").button( 
    { text: false, icons: { primary: "ui-icon-locked" } });

Upvotes: 2

Related Questions