Created
November 19, 2017 17:56
-
-
Save Sarapulov/941e7e06dee7ac615a8bc84714e71e64 to your computer and use it in GitHub Desktop.
set and unset checkbox on Web Widget
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set and unset checkbox on Web Widget | |
// jQuery is epxected | |
// fieldHandler.setCheckbox("45510285"); // call to set | |
// fieldHandler.unsetCheckbox("45510285"); // call to unset | |
var fieldHandler = (function() { | |
return { | |
getCheckbox: function(field_id) { | |
return $("iframe#webWidget").contents().find('input[name='+field_id+']'); | |
}, | |
setCheckbox: function(field_id) { | |
this.getCheckbox(field_id) && this.getCheckbox(field_id).prop('value', "1").prop('checked', true).next().find('span').removeClass('src-component-field-Checkbox-checkmarkUnchecked u-isHiddenVisually');; | |
}, | |
unsetCheckbox: function(field_id) { | |
this.getCheckbox(field_id) && this.getCheckbox(field_id).prop('value', "0").prop('checked', false).next().find('span').addClass('src-component-field-Checkbox-checkmarkUnchecked u-isHiddenVisually');; | |
} | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment