How to make the field disappear if the calculation turns out to be 0?

[ad_1]

I am trying to create code that shows a field only on certain conditions after the field calculation is performed. For example if adding 2 fields before it results in less then a certain amount, then not to show the field.

I tried using document.queryselector but in the console it shows that my selector: ‘div.fieldname28_1’ is invalid because it is now div ‘div.(0)_1’ and it’s an invalid selector.

Here is my code in the field that is not working:

(function(){
function removeField(){
document.querySelector(‘div.fieldname28_1’).setAttribute(“style”, “display : none”);
}

let p = CEIL(fieldname4 * 0);
if (fieldname4 == “” || fieldname4 == null) return “Please Enter Value in the <Approximate Lineal Ft>”;
else if(p <= 0) removeField();
else return p;
})();

You can test it by going to the address where the plugin is installed. Enter 100 into the approximate linear feet. Select the Horizontal fence style. Select the 1×5.5×6 board size.

The page I need help with: [log in to see the link]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer