Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(checkbox): Fix indeterminate button in JS checkbox demo #374

Merged
merged 2 commits into from
Mar 3, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions demos/checkbox.html
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ <h2>With Javascript</h2>
<div class="mdc-form-field">
<div id="mdc-js-checkbox" class="mdc-checkbox">
<input type="checkbox"
id="my-checkbox"
id="native-js-checkbox"
class="mdc-checkbox__native-control"/>
<div class="mdc-checkbox__background">
<svg version="1.1"
Expand All @@ -106,7 +106,7 @@ <h2>With Javascript</h2>

</div>
</div>
<label for="my-checkbox" id="my-checkbox-label">This is my checkbox</label>
<label for="native-js-checkbox" id="my-checkbox-label">This is my checkbox</label>
</div>
<button type="button" id="make-ind">Make indeterminate</button>
</section>
Expand Down Expand Up @@ -144,15 +144,14 @@ <h2>Dark Theme</h2>
var MDCFormField = global.mdc.formField.MDCFormField;

var checkbox = document.getElementById('mdc-js-checkbox');
var checkboxInstance = new MDCCheckbox(document.getElementById('mdc-js-checkbox'));
var checkboxInstance = new MDCCheckbox(checkbox);

var formField = checkbox.parentElement;
var formFieldInstance = new MDCFormField(formField);

formFieldInstance.input = checkboxInstance;

document.getElementById('make-ind').addEventListener('click', function() {
checkbox.indeterminate = true;
checkboxInstance.indeterminate = true;
});
})(this);
</script>
Expand Down