Need help with this javascript code for this calculator!
-
Hi there! Thank you very much for viewing!
I am working on trying to add these calculators over to this new site that I built with WordPress, but I am having no luck! The HTML and CSS work, but I do not think I am adding the Javascript, as the Calculate and Clear buttons do not function, here at:
http://www.dbhirdotrucking.com/#calculatorsI am completely new with JS in WP, but after researching, I added this line code to the themes header.php and calculators-page.php (the template I used for the page):
<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/calc.js"></script>Which references to the calc.js, which is:
<script type="text/javascript"> function calculate() { var length =$('.length_ajax').val(); var width =$('.width_ajax').val(); var depth =$('.depth_ajax').val(); var tot = length*width*depth/324; var tot = tot.toFixed(2); $('.totalcal').val(tot); var sf = length*width; var sf = sf.toFixed(2); $('.squarefeet').val(sf); } function clearall() { $('.length_ajax').val(''); $('.width_ajax').val(''); $('.depth_ajax').val(''); $('.totalcal').val(''); $('.squarefeet').val(''); } </script>I have spent days trying to figure this out on my own, but I really need help please! Any attempts to help are GREATLY appreciated!
Thanks for reading!!!
Mike
The topic ‘Need help with this javascript code for this calculator!’ is closed to new replies.