I'm trying to put a checkbox form in a dropdown like this:
<ul>
<li class="dropdown">
<a href="#" data-toggle="dropdown" class="dropdown-toggle">
Dropdown Form<b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><label class="checkbox"><input type="checkbox">Two</label></li>
<li><label class="checkbox"><input type="checkbox">Two</label></li>
</ul>
</li>
</ul>
Here is a Demo in Bootply
However, as you can see in the demo, for whatever reason the actual checkbox itself appears outside of the dropdown menu. Can anyone tell me what's causing that, and how it should be implemented instead? If I take the label class out it works but it's all bunched up.
Here's what we'll build:
HTML
Essentially, we'll look to combine two different sets of Bootstrap controls & styles: Dropdowns & Checkboxes. Inside of each li, we'll use a label instead of an a element, so that we can wrap the checkbox in a label and make the entire row clickable.
<ul class="dropdown-menu checkbox-menu allow-focus">
<li >
<label>
<input type="checkbox"> Cheese
</label>
</li>
</ul>
CSS
We can steal some of the styles normally applied to .dropdown-menu li a, input and apply them to our label option instead. We'll make the label occupy the full width of the container and fix some label / checkbox alignment issues. Additionally, we'll add styles for .active and :hover.
.checkbox-menu li label {
display: block;
padding: 3px 10px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
margin:0;
transition: background-color .4s ease;
}
.checkbox-menu li input {
margin: 0px 5px;
top: 2px;
position: relative;
}
.checkbox-menu li.active label {
background-color: #cbcbff;
font-weight:bold;
}
.checkbox-menu li label:hover,
.checkbox-menu li label:focus {
background-color: #f5f5f5;
}
.checkbox-menu li.active label:hover,
.checkbox-menu li.active label:focus {
background-color: #b8b8ff;
}
JavaScript
Some other housekeeping, we'll manually keep an .active class flag on each list item to correspond to whether or not the item is checked so we can style it appropriately.
$(".checkbox-menu").on("change", "input[type='checkbox']", function() {
$(this).closest("li").toggleClass("active", this.checked);
});
We'll also want to allow multiple selections by allowing the menu to stay open on internal click events by stopping the event from bubbling up
$(document).on('click', '.allow-focus', function (e) {
e.stopPropagation();
});
Demo in Stack Snippets
$(".checkbox-menu").on("change", "input[type='checkbox']", function() {
$(this).closest("li").toggleClass("active", this.checked);
});
$(document).on('click', '.allow-focus', function (e) {
e.stopPropagation();
});
body {
padding: 15px;
}
.checkbox-menu li label {
display: block;
padding: 3px 10px;
clear: both;
font-weight: normal;
line-height: 1.42857143;
color: #333;
white-space: nowrap;
margin:0;
transition: background-color .4s ease;
}
.checkbox-menu li input {
margin: 0px 5px;
top: 2px;
position: relative;
}
.checkbox-menu li.active label {
background-color: #cbcbff;
font-weight:bold;
}
.checkbox-menu li label:hover,
.checkbox-menu li label:focus {
background-color: #f5f5f5;
}
.checkbox-menu li.active label:hover,
.checkbox-menu li.active label:focus {
background-color: #b8b8ff;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script>
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button"
id="dropdownMenu1" data-toggle="dropdown"
aria-haspopup="true" aria-expanded="true">
<i class="glyphicon glyphicon-cog"></i>
<span class="caret"></span>
</button>
<ul class="dropdown-menu checkbox-menu allow-focus" aria-labelledby="dropdownMenu1">
<li >
<label>
<input type="checkbox"> Cheese
</label>
</li>
<li >
<label>
<input type="checkbox"> Pepperoni
</label>
</li>
<li >
<label>
<input type="checkbox"> Peppers
</label>
</li>
</ul>
</div>
The way Bootstrap uses checkboxes in their docs is as following:
<div class="checkbox">
<label>
<input type="checkbox">Two
</label>
</div>
So yours would look like:
<ul>
<li class="dropdown">
Dropdown Form<b class="caret"></b>
<ul class="dropdown-menu">
<li>
<div class="checkbox">
<label>
<input type="checkbox">Two
</label>
</div>
</li>
<li>
<div class="checkbox">
<label>
<input type="checkbox">Two
</label>
</div>
</li>
</ul>
</li>
</ul>
The docs:
http://getbootstrap.com/css/#forms
I think a simple solution would be,
<div class="dropdown">
<button class="btn btn-secondary dropdown-toggle" type="button"
id="sampleDropdownMenu" data-toggle="dropdown">
Dropdown
</button>
<div class="dropdown-menu">
<button class="dropdown-item" type="button">
<input type="checkbox">Action
</button>
<button class="dropdown-item" type="button">
<input type="checkbox">Action
</button>
<button class="dropdown-item" type="button">
<input type="checkbox">Action
</button>
</div>
</div>
The problem here is that your checkboxes are being styled (by Bootstrap) with:
.checkbox input[type=checkbox]{
position: absolute;
margin-left: -20px;
}
This is probably done to avoid those "bunching" issues you see when you remove the .checkbox class on the <label>, but that negative margin-left is causing problems in this case.
One way to address this with minimal adjustment to your markup and CSS would just be to add some padding on the <label> to account for it:
label.checkbox{
padding-left:20px;
}
Here's an updated Bootply to show you the code in action. Hope this helps! Let me know if you have any questions.
Related
I'm trying to create a dropdown menu that can be navigated by using the keyboard. I can get the first level to work by using the tab key, but have been unable to access the second level. Example can be found here https://codepen.io/jjfash/pen/oNgqEjx
The html:
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="featuredTopics">
<a class="btn btn-semiTransparent dropdown-toggle" id="dropdownMenu1" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" tabindex="0">News Archive</a>
<ul class="dropdown-menu" role="menu" aria-labelledby="dropdownMenu">
<li class="dropdown-submenu pull-right dropdown-item"><a tabindex="0" href="#">2017</a>
<div class="dropdown-menu">
<ul>
<li class="dropdown-item"><a tabindex="0" href="#">Q1</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q2</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q3</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q4</a></li>
</ul>
</div>
</li>
<li class="dropdown-submenu pull-right dropdown-item"><a tabindex="0" href="#">2018</a>
<div class="dropdown-menu">
<ul>
<li class="dropdown-item"><a tabindex="0" href="#">Q1</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q2</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q3</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q4</a></li>
</ul>
</div>
</li>
<li class="dropdown-submenu pull-right dropdown-item"><a tabindex="0" href="#">2019</a>
<div class="dropdown-menu">
<ul>
<li class="dropdown-item"><a tabindex="0" href="#">Q1</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q2</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q3</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q4</a></li>
</ul>
</div>
</li>
<li class="dropdown-submenu pull-right dropdown-item"><a tabindex="0" href="#">2020</a>
<div class="dropdown-menu">
<ul>
<li class="dropdown-item"><a tabindex="0" href="#">Q1</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q2</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q3</a></li>
<li class="dropdown-item"><a tabindex="0" href="#">Q4</a></li>
</ul>
</div>
</li>
</ul>
</div>
</body>
</html>
The CSS:
/* Buttons */
.btn {
border:none;
padding:12px;
color:#fff;
border-radius:0;
box-shadow: 0px 2px 5px rgba(0,0,0,0.2);
}
.btn:hover,
.btn:focus,
.btn:active {
text-decoration:underline;
color:#fff;
}
.btn:focus {
box-shadow: 0px 2px 5px rgba(0,0,0,0.2);
}
.btn-semiTransparent:hover,
.btn-semiTransparent:focus,
.btn-semiTransparent:active {
background:rgba(0,0,0,.1);
color:#1f2a44;
}
.btn-semiTransparent:not(:disabled):not(.disabled):active {
box-shadow: inset 0px 0px 5px #666 !important; /* makes it look like you've pressed the button */
}
/* Dropdown Menu */
.dropdown-item {
margin:0;
padding:0;
text-align:left;
}
.dropdown-submenu .dropdown-menu {
left:100%;
top:-3px;
border-radius:0;
}
.dropdown-submenu {
position: relative;
}
.dropdown-submenu:hover>.dropdown-menu {
display: block;
}
.dropdown-submenu:hover>a:after {
border-left-color: #fff;
}
.dropdown-submenu.pull-left {
float: none;
}
.dropdown-submenu.pull-left>.dropdown-menu {
right:100%;
}
.dropdown-item:focus,
.dropdown-item:hover,
.dropdown-item:active {
background:#e6e6e6;
}
.dropdown-toggle {
line-height:120%; /* makes the height of the button similar to the regular buttons. having the caret as an ::after is making it taller */
}
.dropdown-toggle::after {
font-family: 'FontAwesome';/* essential to enable caret symbol*/
content:"\f054" !important;
color:#a84300;
border:none !important;
min-width:16px;
position:relative;
top:4px;
}
.dropdown-toggle[aria-expanded="true"]::after{
content:"\f078" !important;
color:initial;
}
li.dropdown-submenu>a:after {
font-family: 'FontAwesome';/* essential to enable caret symbol*/
content:"\f054";
color:#a84300;
position:relative;
left:8px;
display:inline-block;
width:15px;
}
li.dropdown-submenu:hover > a {
text-decoration:none;
}
li.dropdown-submenu:hover > a:after {
content:"\f078" !important;
color:initial;
}
.dropdownPadding {
padding:0px 150px 50px;
background:transparent;
border:none;
right:calc(100% - 150px) !important;
}
.dropdownPadding ul {
border:1px solid #ccc;
margin:0;
padding:10px 0;
background:#fff;
}
At minimum, I'd like it so the menu is fully navigable using the keyboard for ADA compliance. My best case scenario would be working using arrow keys (not just the tab key) to navigate. I tried adding tabindex="0" to each element hoping that would work, but no luck so far.
There are a few ways to handle this but a great place to start is this W3C article about Menus as this covers a lot of the basics of menu design, sub menus, expected controls etc.
It also has some examples of how to set up the JavaScript for the expected functionality so that will help you.
One of the key parts is intercepting the enter key to open sub-levels, either directly on the menu item or as a separate drop down arrow next to the main menu item.
I personally prefer having any top level items not being a link and instead being used as toggles to open sub menus but it depends on your site architecture.
The last thing you want is to make each sub-menu accessible via just tabbing. At that point if someone wants to reach "2020 Q4" they would have to tab past 15 items.
What you want instead is for each 'quarter picker' to open after pressing either enter or the right arrow key.
That way to get to "2020 Q4" is just 4 tabs, enter (or right arrow), 4 tabs so only 9 key presses (instead of 15).
One last thing to consider is that your menu needs to work without JavaScript or offer an alternative.
What I tend to do is have a <noscript> element with a link to the complete HTML sitemap show if they don't have JavaScript enabled and I have a more complex menu such as this.
I want to create a drop down menu, when i click the glyphicon the down arrow, it should view the drop down menu which has these items [Messages, log out, etc..].
However when i click it nothing appears at all, what is missing here?
//Html File:
<html>
<!-- Head -->
<head>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/bootstrap-theme.min.css" rel="stylesheet">
<link href="css/font-awesome.min.css" rel="stylesheet">
<link href="css/bootstrap-social.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
</head>
<!-- Body -->
<body>
<div class="navbar">
<i class="fa fa-home"></i> Marble
<a class="left"> <i onclick="myFunction(this)" class=" fa fa-bell" ></i> Notifications </a>
<a class="left user"> <i class=" fa fa-user-circle"> </i> User </a>
<div class="dropdown">
<a class="editClass dropdown-toggle" data-toggle="dropdown" > <span class=" glyphicon glyphicon-menu-down"></span> </a>
<ul class="dropdown-menu"> //when i remove class="dropdown-menu", the items appears but the drop down is gone, and when i add them back, the items are not shown when i click the drop down icon.
<li> <a> <i class="fa fa-envelope-o"></i> Messages </a> </li>
<li role="separator" class="divider"></li>
<li> <a> <i class="fa fa-hourglass-3"></i> Timeline </a> </li>
<li role="separator" class="divider"></li>
<li> <a> <i class="fa fa-cog"></i> Settings </a> </li>
<li role="separator" class="divider"></li>
<li> <a> <span class="glyphicon glyphicon-log-out"></span> Log Out </a> </li>
<li role="separator" class="divider"></li>
</ul>
</div>
</div>
<div>
<img src="Diagram.png" alt="diagram" width="400" height="300">
</div>
<div>
<p id="sentence"> "You don't have any projects" </p>
<button onclick="createProject()" class="button1 btn btn-lg"> <b> Add Project </b> </button>
</div>
<div>
<form class="form-popup" id="projects">
<h2 align="center"> <span class="glyphicon glyphicon-th"></span> New Project </h2>
<input type="text" placeholder="Project Name" required> <br>
<textarea placeholder="Project Description" required=""></textarea> <br>
<p> Start Date: </p>
<p> End Date: </p>
<input type="Date" name="start Date" required="">
<input type="Date" name="End Date" required="">
<h2 align="center"> <span class="glyphicon glyphicon-book"> </span> References </h2>
<div id="refTextBoxes">
<input type="text" placeholder="Add Reference" required> <br>
</div>
<button onclick="addRef()"> Add another </button> <br>
<button type="submit" onclick="hideAndAdd()" > Done </button>
<!-- class="btn" bt3ml el button shakl kda 7elw -->
</form>
</div>
<script>
function myFunction(x)
{
x.classList.toggle("fa-bell-slash");
}
function createProject()
{
document.getElementById("projects").style.display = "block";
}
function addRef()
{
var totalTextBoxes = document.getElementsByClassName("input_text");
totalTextBoxes = totalTextBoxes.length + 1;
document.getElementById("refTextBoxes").innerHTML=document.getElementById("refTextBoxes").innerHTML+
"<input type='text' class='input_text' id='input_text"+totalTextBoxes+"' placeholder='Add Reference' + required> <br>";
}
function hideAndAdd()
{
var x = document.getElementById("sentence");
x.style.display = "none";
}
</script>
</body>
<!-- Closing of html tag -->
</html>
//Css File:
body
{
font-family: Arial, Helvetica, sans-serif;
/* background-color: #ABB1BA; */
}
.form-popup
{
display: none;
}
/* Style the navigation bar */
.navbar
{
width: 100%;
background-color: #877ebf;
overflow: auto;
}
/* Navbar links */
.navbar a
{
float: left ;
text-decoration: none;
color: #CCCCCC;
font-size: 17px;
padding: 12px;
}
/* Navbar links on mouse-over */
.navbar a:hover, i:hover, span:hover
{
background-color: #555;
cursor: pointer;
}
img
{
display: block;
margin-left: auto;
margin-right: auto;
}
p
{
text-align: center;
font-family: "Arial Black", Gadget, sans-serif;
font-size: 20px;
}
button
{
text-align: center;
font-size: 16px;
margin: 25px 475px;
cursor: pointer;
}
.button1
{
background-color: #CCCCCC;
color: #333333;
border: 4px solid #877ebf;
}
/*
.navbar i.editClass, span.editClass
{
float: right;
}
*/
.left
{
position: absolute;
right:135;
}
.user
{
/*margin: 25px 25px; */
/*float: right;
padding: 100px; */
position: absolute;
right:40;
}
.editClass
{
position: absolute;
right:5;
}
/* Add responsiveness - will automatically display the navbar vertically instead of horizontally on screens less than 500 pixels */
#media screen and (max-width: 500px) {
.navbar a {
float: none;
display: block;
}
}
I'm using here Bootstrap, html, and css.
I think there is problem in the css file, but i can't manage to find where exactly.
You have overflow effectively hidden on your navbar. Remove that.
.navbar {
/* overflow: auto; */
}
Demo
You'll want to get familiar with your browser's document inspector. It'll make diagnosing things like this almost effortless.
CSS:
nav a{
display: none;
}
#menubutton:checked, nav a{
display: block;
color: black;
text-decoration: none;
}
HTML:
<nav>
<img src="pictures/close.png" alt="Close" height="20" width="20">
<a class="navitem" id="firstnavitem" href="index.php">Home</a>
<a class="navitem" href="#">Test</a>
<a class="navitem" href="#">Test</a>
<a class="navitem" href="#">Test</a>
</nav>
I want that the HTML code isn't displayed until the #menubutton is :checked.
(The #menubutton is an invisible checkbox).
If the #menubutton is :checked I want, that the HTML code is displayed. The code that should be displayed is in the css "nav a{}".
Use the adjacent sibling selector +.
#menubutton {
display: none;
}
nav * {
display: none;
}
#menubutton:checked + nav * {
display: block;
color: black;
text-decoration: none;
}
#closeMenu {
height: 20px;
width: 20px;
}
<label for="menubutton">MenuButton</label>
<input type="checkbox" id="menubutton" />
<nav>
<label for="menubutton"><img src="pictures/close.png" alt="close menu" id="closeMenu" /></label>
<a class="navitem" id="firstnavitem" href="index.php">Home</a>
<a class="navitem" href="#">Test</a>
<a class="navitem" href="#">Test</a>
<a class="navitem" href="#">Test</a>
</nav>
If there are other elements in between your #menubutton and your nav element, you might need to make use of the general sibling selector ~ instead.
css
input[type=checkbox] + label {
color: #ccc;
font-style: italic;
}
input[type=checkbox]:checked + label {
color: #f00;
font-style: normal;
}
html
<input type="checkbox" id="ossm" name="ossm">
<label for="ossm">CSS is Awesome</label>
This works with pure CSS and HTML using the :target psuedo class. It works as of IE 9. See MSDN for more info.
Watch out: the :target psuedo-class relies on the fragment (or hash) of the current URL, so it might mess up internal page navigation.
#menu {
display: none;
}
#menu:target {
display: block;
}
Menu
<nav id="menu">
Close |
<a class="navitem" id="firstnavitem" href="index.php">Home</a> |
<a class="navitem" href="#">Test</a> |
<a class="navitem" href="#">Test</a> |
<a class="navitem" href="#">Test</a>
</nav>
I open and close toggle if i click to href=#collapseFive
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion5" href="#collapseFive">
<strong><i class="icon-caret-down"></i>SomeText</strong>
</a>
<div id="collapseFive" class="panel-collapse collapse">
I want to set default toggle "open" for div id="collapseFive" class="panel-collapse collapse"
So how can do this without javascript ?
I am not giving you complete solution but you can try this way.. please open this fiddle:
<label for="menu-toggle">Click me to toggle menu</label>
<input type="checkbox" id="menu-toggle"/>
<ul id="menu">
<li>First link</li>
<li>Second link</li>
<li>Third link</li>
</ul>
css
label {
cursor: pointer;
}
#menu-toggle {
display: none; /* hide the checkbox */
}
#menu {
display: none;
}
#menu-toggle:checked + #menu {
display: block;
}
JsFiddle
I'm afraid you can't set the data-* attributes using only CSS. That requires attribute values (other that "style") to be changed and that's where JavaScript comes in.
You can check out this JSFiddle where an accordion has been created only with CSS:
http://jsbin.com/UnEwelO/1/edit
You might also find this article interesting:
http://andydavies.me/blog/2012/08/13/what-if-we-could-use-css-to-manipulate-html-attributes/
Can anyone tell me how to disable a div or elements inside a div?
I have a jstree in my div and I want to disable the div/jstree.
Thanks!
I made a simple example for you here
Basically, it creates a div over your jstree's one so that it is disabled from user interactions.
I guess you can make it visually better, but i think this gives you the idea.
I also checked that there is no strigth way to disable a jstree, even if it could be usefull.
Maybe you'd want to ask the dev in google group...
HTML Code:
<button id="disable">Disable</button>
<button id="enable">Enable</button>
<div id="jstree-wrapper">
<div id="demo" style="height:100px;">
<ul>
<li id="node_1_id">
<a>Root node 1</a>
<ul>
<li id="child_node_1_id">
<a>Child node 1</a>
</li>
<li id="child_node_2_id">
<a>Child node 2</a>
</li>
</ul>
</li>
</ul>
<ul>
<li><a>Team A's Projects</a>
<ul>
<li><a>Iteration 1</a>
<ul>
<li><a>Story A</a></li>
<li><a>Story B</a></li>
<li><a>Story C</a></li>
</ul>
</li>
<li><a>Iteration 2</a>
<ul>
<li><a>Story D</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div id="disabler"></div>
</div>
CSS code:
#jstree-wrapper {
position: relative;
}
#disabler {
position: absolute;
top: 0px;
left: 0px;
background-color: black;
opacity: 0.5;
}
JS Code:
$(document).ready(function() {
$("#demo").jstree();
$("#disable").on("click", function() {
$("#disabler").css("width", $("#demo").width());
$("#disabler").css("height", $("#demo").height());
});
$("#enable").on("click", function() {
$("#disabler").css("width", "0px");
$("#disabler").css("height", "0px");
});
});
Here's a very good example I didn't find done so simple and good anywhere else. In this example you can simulate the 'disabled' attribute only by adding CSS style as I entered in the code snippet. It disables by using the CSS "visible:hidden", and adds a translucent mask to cover the whole div area and disable anything inside it. You can choose to comment out the 'Visibility:hidden' to be able to see the elements behind the mask, but then they will be tabable, if you don't mind them hidden then uncomment that style.
function disable(elementId, enabling) {
el = document.getElementById(elementId);
if (enabling) {
el.classList.remove("masked");
} else
{
el.classList.add("masked");
}
}
.masked {
position: relative;
pointer-events: none;
display: inline-block;
//visibility:hidden; /* Uncomment this for complete disabling */
}
.masked::before {
position: absolute;
width: 100%;
height: 100%;
top: 0px;
left: 0px;
visibility: visible;
opacity: 0.2;
background-color: black;
content: "";
}
<button onclick="alert('Now, click \'OK\' then \'Tab\' key to focus next button.\nThen click \'Enter\' to activate it.');">Test</button>
<div id="div1" style="display:inline-block" class="masked">
<button onclick="alert('Sample button was clicked.')">Maskakable</button>
<button onclick="alert('Sample button was clicked.')">Maskakable</button><br/>
<br/>
<button onclick="alert('Sample button was clicked.')">Maskakable</button>
<button onclick="alert('Sample button was clicked.')">Maskakable</button>
</div>
<button>Dummy</button>
<br/>
<br/>
<br/>
<button id="enableBtn" onclick="disable('div1',true);disable('enableBtn',false);disable('disableBtn',true);">Enable</button>
<button id="disableBtn" onclick="disable('div1',false);disable('enableBtn',true);disable('disableBtn',false);" class="masked">Disable</button>