EasyUI Forum
October 30, 2025, 01:30:44 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Integrate switchbutton with <label>  (Read 7798 times)
aswzen
Sr. Member
****
Posts: 287


Indonesian

aswzen
View Profile WWW Email
« on: December 17, 2015, 03:03:22 AM »

Can you make switchbutton integrates with label?

So basically when the switchbutton inside the label, we can toggle it by clicking the label.

I try to make it manually, but there is no toggle method in documentation
Code:
<label onClick="$('#EMAIL_EQU').switchbutton('check');">
     <input class="easyui-switchbutton" id="EMAIL_EQU" data-options="onText:'Yes',offText:'No'"> Send Equipment Revision Notification
</label>

Can you make it more simple?

Thank you in advance  Smiley
Logged

Regards,
Sigit

- Indonesian jEasyUI Facebook page : https://www.facebook.com/groups/jeasyuiid/
jarry
Administrator
Hero Member
*****
Posts: 2300


View Profile Email
« Reply #1 on: December 17, 2015, 11:43:40 PM »

Please call the 'makeClickable' function to make switchbutton work inside a label.
Code:
function makeClickable(buttons){
$(buttons).each(function(){
var b = $(this).data('switchbutton').switchbutton;
$(this).bind('click', function(){
b.triggerHandler('click');
return false;
});
b.bind('click', function(){
return false;
});
})
}

Code:
<label>
     <input class="easyui-switchbutton" id="EMAIL_EQU" data-options="onText:'Yes',offText:'No'"> Send Equipment Revision Notification
</label>
<script>
$(function(){
makeClickable('#EMAIL_EQU');
})
</script>
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!