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
I have a check box which I have registered a JS callback for in order to hide / show some fields, as you can see there are a couple console logs in there to help me debug.
The problem with this is that for each change in the checkbox so unchecking it or checking it this code fires twice. with some odd results. See below the code for what I am getting as a console output.
function overrideTermChecked (changed, collection, shortcode) {
function attributeByName (name) {
return _.find(
collection,
function (viewModel) {
return name === viewModel.model.get('attr');
}
);
}
var updatedVal = changed.value,
override_term = attributeByName('term'),
override_msg = attributeByName('content');
console.log(typeof updatedVal);
console.log(updatedVal);
if (updatedVal) {
console.log('Should Show');
override_term.$el.show();
override_msg.$el.show();
} else {
console.log('Should Hide');
override_term.$el.hide();
override_msg.$el.hide();
}
}
wp.shortcake.hooks.addAction('glossary_tooltip.override', overrideTermChecked);
So I am not able to make the 2 text fields for term / content show they remain hidden all the time. Is this an issue with my implementation?
The text was updated successfully, but these errors were encountered:
I never sound a solution to this problem. I changed how I handled this by not using events and did somthing else which wont work in most cases for other users. Sorry I couldn't be more help.
I have a check box which I have registered a JS callback for in order to hide / show some fields, as you can see there are a couple console logs in there to help me debug.
The problem with this is that for each change in the checkbox so unchecking it or checking it this code fires twice. with some odd results. See below the code for what I am getting as a console output.
So I am not able to make the 2 text fields for term / content show they remain hidden all the time. Is this an issue with my implementation?
The text was updated successfully, but these errors were encountered: