Skip to content

On ASP.NET a random but concise sequence of letters and numbers #85

Answered by palcarazm
Jackietkfrost asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Jackietkfrost,

Have you tried as workaround to initialize the toggle via the JS API. I let you a demo:

  1. Set the HTML in the _Layout.cshtml
<input type="checkbox" checked id="theme-toggle">
  1. On document loaded run the javascript code that fit your bootstrap5-toggle interface:

2.A) With jQuery interface

$('#theme-toggle').bootstrapToggle({
        on: '<img src="assets/icons/sun-fill.svg"> Light',
        off: 'Dark',
        onstyle: 'warning',
        offstyle: 'dark',
        style : 'android'
    });

2.B) With ECMAS (vanilla JS) interface

document.querySelector('#theme-toggle').bootstrapToggle({
        on: '<img src="assets/icons/sun-fill.svg"> Light',
        off: 'Dark',
        

Replies: 16 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by palcarazm
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
help wanted Extra attention is needed
2 participants
Converted from issue

This discussion was converted from issue #46 on December 16, 2022 09:03.