I am a Developer, Blogger and Coffee addict. Java developer by profession, Q2A developer by addiction. This is my personal website where I write few stuff which could be useful for other developers.
The CKeditor fires an event instanceReady once the instances are ready to be used.
So we need to create a listener which will listen for this event.
We will only execute the event handler if the browser window width is less than the some defined width for a small screen devices.
In Jquery the width of the browser window can be determined by $.width() method by calling on window object.
How to use this for Question2Answer websites
If you are a owner of a Question2Answer website and you wish to show the plain text editor to your users who is viewing the site on their mobile device, this would be the best way to go.
Steps –
Login into your website as Admin
Navigate to Admin -> Layout
Paste the above code in Custom HTML at bottom of every page: section
You may change the value here given as per your requirement destroyCKEditor(500);. Here the 500 is the minimum allowed width, below which all the CKEditor instances will be destroyed
If you want to reset the input type using traditional method will not work .
For doing so you wrap() a <form> around the element, call reset() on the newly created form, then remove the form using unwrap()
Are you looking for a piece of code where you need to toggle the radio button values. JQuery provices handful of methods by using which we can acomplish easily.
Here you go with step by step approach.
Step 1. HTML Code
Create two checkboxes and by default let one of them be checked. Then create a button which will act as a switch. When we click the button the radio button will toggle.
The ready event occurs after the HTML document has been loaded (when the document is ready to be manipulated i.e browser has build the DOM tree ), while the onload event occurs later, when all content (e.g. images and other resources) also has been loaded.
The onload event is a standard event in the DOM, while the ready event is specific to jQuery. The purpose of the ready event is that it should occur as early as possible after the document has loaded, so that code that adds functionality to the elements in the page doesn’t have to wait for all content to load.