-
Jul 18th, 2021, 03:43 AM
#1
Thread Starter
Fanatic Member
how to display the 'Status' side by side with the Switch?
Hi All,
I'm learning HTML, I have HTML code below, how to display the 'Status' side by side with the Switch?
Code:
<div>
<label>Status</label>
<label class="c-switch c-switch-pill c-switch-label c-switch-primary mb-1">
<input type="checkbox" class="c-switch-input" id="input-active" name="active" value="true" @(Model.active ? "checked" : "")>
<span class="c-switch-slider" data-checked="✓" data-unchecked="✕"></span>
</label>
</div>
-
Jul 19th, 2021, 09:30 AM
#2
Re: how to display the 'Status' side by side with the Switch?
You can use JavaScript to:
- Get the input by its id
- Get the input's checked value
Code:
var checkbox = document.getElementById('input-active');
var checkboxChecked = checkbox.checked;
console.log(checkboxChecked);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|