[Ovmsdev] Slider widget not disabled when first loading unchecked?

Michael Geddes frog at bunyip.wheelycreek.net
Tue Dec 27 11:04:52 HKT 2022

Hi all,
I've noticed that if you create a 'slider' widget with a checkbox that if
it's unchecked when it first loads, then the slider is enabled. If you
check/uncheck then the slider is disabled. Or at least that's what I seen
in google chrome.

I'm really not familiar with NodeJS, but this _seems_ to fix the problem:

Does this fix make sense?  If so - I'll do a p/r for it.


* Slider widget plugin

 $.fn.slider = function(options) {
   return this.each(function() {
-    var $sld = $(this).closest('.slider'), data = $.extend({ checked: true
}, $sld.data());
+    var $sld = $(this).closest('.slider'), $cbi =
$sld.find('.slider-enable'), data = $.extend({ checked:
$cbi.prop("checked") }, $sld.data());
     var opts = (typeof options == "object") ? options : data;
     // init?
     if ($sld.children().length == 0) {
       var id = $sld.attr('id');
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openvehicles.com/pipermail/ovmsdev/attachments/20221227/384555e3/attachment.htm>

More information about the OvmsDev mailing list