Țaman ŞheƦzad Țaman ŞheƦzad - 3 months ago 36x
HTML Question

jQuery/JavaScript toggle button to add Inline styles

How to create a toggle button to add inline styles?

For example in this simple structure i want to make a toggle button to show or hide the div
I do not want to add a class name or using only .show() and .hide() in jQuery

I need it to be Inline style for example If i toggle the button i want it to add this style

style="display:block color:red;"

and if you toggle again



<div>blah bla blah</div>


You can check toggle style with .css("display") .Then set attribute as you wanted to do

        if($("div").css("display") == "none") {