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

bootstrap switch check box is not display ON when I have refreshed the page with value TRUE #709

Open
JigneshPatel04 opened this issue Jul 15, 2019 · 2 comments

Comments

@JigneshPatel04
Copy link

JigneshPatel04 commented Jul 15, 2019

I have used bootstrap-switch for display checkbox on/off
It is working when I have switched on or off but when I have get value from database and I assigned value checked on input checked box then it is not display on.

checkbox
<input data-id="{{id}}" type="checkbox" {{#if approved}} checked {{/if}} name="approved">

<script> $("[name ='approved']").bootstrapSwitch(); // I have set value in database when checkbox on/off $(document).ready(() => { $("[name ='approved']").on("switchChange.bootstrapSwitch", function (e, data) { }); }); </script>
@JigneshPatel04 JigneshPatel04 changed the title bootstrap switch check box is not working when I have true value bootstrap switch check box is not display ON when I have refreshed the page with value TRUE Jul 15, 2019
@DSpeichert
Copy link

DSpeichert commented Jul 23, 2019

Duplicates #703
It appears to work at v3.3.4 and breaks in v3.3.5.

@souzaemarcal
Copy link

Solved here with this:

$(function() {
	$('[data-switch="true"]').each(function () {
		$(this).bootstrapSwitch({ state: $(this).is(':checked') }).trigger('change');
	});
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants