w3resource

jQuery UI: Initialize the button and do not show the label

jQuery UI Fundamental - I : Exercise-17

Initialize the button and do not show the label.

Sample solution :

HTML Code :

<!DOCTYPE html>
<html>
<head>
<link href="https://code.jquery.com/ui/jquery-ui-git.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-git.js"></script>
<script src="https://code.jquery.com/ui/jquery-ui-git.js"></script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Initialize the button and do not show the label.</title>
</head>      
<body>
<button id="button1">Button label</button>    
</body>
</html>

JavaScript Code :

$( "#button1" ).button({
  text: false
});


$( "#button1" ).button( "option", "text", false );

See the Pen jquery-ui-fundamental-exercise-17 by w3resource (@w3resource) on CodePen.


Contribute your code and comments through Disqus.

Previous: Initialize the button and specify an icon on the button.
Next: Initialize the buttonset and specify disabled option true.

What is the difficulty level of this exercise?