We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Setting the toggle state of a button

Thread ID:

Created:

Updated:

Platform:

Replies:

132844 Sep 25,2017 06:58 AM Sep 26,2017 08:35 AM ASP.NET Core 1
loading
Tags: Button
Merovingian
Asked On September 25, 2017 09:30 AM


How do I toggle a button programmatically in javascript? I tried the following but it doesn't work

var btn = $("#btn").data("ejToggleButton");
btn.toggleState(false);

Berly Christopher [Syncfusion]
Replied On September 26, 2017 08:35 AM

Hi Louis, 
 
Thanks for contacting Syncfusion support. 
 
We have checked with your query. To make use of ToggleButton’s API please refer the below code example.  
 
Index.cshtml: 
 
<input id="toggle" type="checkbox" />  
<script> 
 
    $("#toggle").ejToggleButton({defaultText:"Play",activeText:"Pause"}); //control initialization 
    var btn = $("#toggle").data("ejToggleButton"); // instance creation for toggle button 
    btn.option("toggleState",false); // toggle state declaration 
</script> 
 
You can define the ToggleState API for the Toggle Button in ASP.NET Core also. Please refer the below code. 
 
Index.cshtml: 
 
<ej-toggle-button id="check11" default-text="play" active-text="pause" toggle-state="false"/> 
 
Please refer the below API Documentation link to know more about toggleState API in the Toggle button. 
 
 
Please refer the below UG documentation link to know more about Toggle button. 
 
We have prepared the simple sample based on your requirement. Please get the sample from the below location. 
 
  
Regards, 
Berly B.C 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;