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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Setting the toggle state of a button

Thread ID:





132844 Sep 25,2017 10:58 AM UTC Sep 26,2017 12:35 PM UTC ASP.NET Core 1
Tags: Button
Asked On September 25, 2017 01:30 PM UTC

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

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

Berly Christopher [Syncfusion]
Replied On September 26, 2017 12:35 PM UTC

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.  
<input id="toggle" type="checkbox" />  
    $("#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 
You can define the ToggleState API for the Toggle Button in ASP.NET Core also. Please refer the below code. 
<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. 
Berly B.C 


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon