You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The initial state of the switchery is always false when it is obtained by Javscript / jQuery code, when the page is loaded or rendered having this checked / unchecked value preset in the HTML code.
I want to retrieve the current state (checked / unchecked) to use in a validation of data entered into a form.
Javascript / Jquery 3.2.1
if( $('#checkIsIndoor').prop('checked')===true) {
if ( $("#inputHeight").val().trim() === '' ){
showError('inputHeight', 'As it is an Interior Meeting Space you must enter the height in meters.');
todoOk = false;
}
else{
clearErrors('inputHeight');
}
}
However, after clicking on the Switchery and re-executing the code that gets the value of the Switchery / Checkbox, the value is correct.
The only thing that works for me correctly and should not be is:
if ($("#checkEsInterior + span.switchery-default").css('background-color')=="rgb(38, 185, 154)"){
if ( $("#inputHeight").val().trim() === '' ){
showError('inputHeight', 'As it is an Interior Meeting Space you must enter the height in meters.');
todoOk = false;
}
else{
clearErrors('inputHeight');
}
}
The color rgb (38, 185, 154) is the checked status color of the Switchery by default.
Why does this happen?
The text was updated successfully, but these errors were encountered:
The initial state of the switchery is always false when it is obtained by Javscript / jQuery code, when the page is loaded or rendered having this checked / unchecked value preset in the HTML code.
I want to retrieve the current state (checked / unchecked) to use in a validation of data entered into a form.
Javascript / Jquery 3.2.1
HTML
However, after clicking on the Switchery and re-executing the code that gets the value of the Switchery / Checkbox, the value is correct.
The only thing that works for me correctly and should not be is:
The color rgb (38, 185, 154) is the checked status color of the Switchery by default.
Why does this happen?
The text was updated successfully, but these errors were encountered: