LinkButton

Override defaults with $.fn.linkbutton.defaults.

The linkbutton is used to create a hyperlink button. It is a representation of a normal <a> tag. It can display both an icon and text, or only the icon or text. The button width can dynamic and shrink/expand to fit its text labels.

Usage Example

Create linkbutton

Create a linkbutton from markup is more easily.

  1. <a id="btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">easyui</a>

Create a linkbutton programmatically is also allowed.

  1. <a id="btn" href="#">easyui</a>
  2. $('#btn').linkbutton({
  3. iconCls: 'icon-search'
  4. });
Process clicking on linkbutton.

Clicking on linkbutton will send the user to other page.

  1. <a href="otherpage.php" class="easyui-linkbutton" data-options="iconCls:'icon-search'">easyui</a>

The example below will alert a message.

  1. <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
  2. onclick="javascript:alert('easyui')">easyui</a>

Bind click handler using jQuery.

  1. <a id="btn" href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'">easyui</a>
  1. $(function(){
  2. $('#btn').bind('click', function(){
  3. alert('easyui');
  4. });
  5. });

Properties

Name Type Description Default
id string The id attribute of this component. null
disabled boolean True to disable the button false
toggle boolean True to enable the user to switch its state to selected or unselected. This property is available since version 1.3.3. false
selected boolean Defines if the button's state is selected. This property is available since version 1.3.3. false
group string The group name that indicates what buttons belong to. This property is available since version 1.3.3. null
plain boolean True to show a plain effect. false
text string The button text. ''
iconCls string A CSS class to display a 16x16 icon on left. null
iconAlign string Position of the button icon. Possible values are: 'left','right'. This property is available since version 1.3.2. left

Methods

Name Parameter Description
options none Return options property.
disable none Disable the button.

Code example:

$('#btn').linkbutton('disable');
enable none Enable the button.

Code example:

$('#btn').linkbutton('enable');
select none Select the button. This method is available since version 1.3.3.
unselect none Unselect the button. This method is available since version 1.3.3.