Does anyone on here know how to make html work on wordpress? I have a fees calculator on here http://www.hullarcheryclub.co.uk/fees.html The calculator has become a big help to new members of the club.. However, when I moved the script to a wordpress page, every thing's there, but the calculate button no longer works.. http://www.hullarcheryclub.co.uk/fees/ any ideas?
I would have to crawl in there perhaps but have you tried to simply toggling the visual editor to html mode? Do that and click save without using the visual editor. That may be a javascript conflict as well. EDIT: This could be the isssue [cycle] terminating; zero elements found by selector That is a new one on me. I don't quite understand that issue. Let me know. Happy to help. Nigel
Hi Nigel. I'm brand new to wordpress, so not fully understanding what yo have said there.. How I added this was, when i added a page, there's 2 sections, visual and text.... I copied the html (including the script) into the text section Thanks for looking
heres the code I'm trying to add as a wordpress page .. works ok as html <!DOCTYPE HTML> <html> <head> <script type="text/javascript"> var price=new Object(); price.year_adult=24; price.year_child=12; price.session_adult=3; price.session_child=2; price.training_adult=30; price.training_child=24; price.insurance_adult=25; price.insurance_child=15; price.badges_adult=2; price.badges_child=2; price.subs_adult=3; price.subs_child=2; price.equipment_adult=2; price.equipment_child=2; function calculate_fee() { var total=0; var age_group='child'; if(document.getElementById('adult_field').checked) { age_group='adult'; } // subtract passed months from full year var selected_month=document.getElementById('month_field').selectedIndex; var remaining_months=12-selected_month; if(selected_month<9) // Months are counted from zero in javascript, so September is 8. { total+=price['year_'+age_group]/12*remaining_months; var pro_rata=total+' ('+remaining_months+' months)'; } // after September the next full year is added too else { total+=price['year_'+age_group]+remaining_months; var pro_rata=total+' ('+(remaining_months+12)+' months)'; } document.getElementById('year').innerHTML=pro_rata; var extras=document.getElementsByClassName('extras'); var result=document.getElementsByClassName('result'); for(var i=0; i<extras.length; i++) { if(extras.checked || extras.value=='checked') { result.innerHTML=price[extras.id+'_'+age_group]; total+=price[extras.id+'_'+age_group]; } else { result.innerHTML=0; } } document.getElementById('session').innerHTML=total; } </script> </head> <body> <div id="body"> <div id="content"> <div id="section"> <table> <tr> <td> Date of joining <select id="month_field"> <option>January</option> <option>February</option> <option>March</option> <option>April</option> <option>May</option> <option>June</option> <option>July</option> <option>August</option> <option>September</option> <option>October</option> <option>November</option> <option>December</option> </select> </td> <td><input type="radio" name="age" id="child_field" value="child">Age 10-15</td> <td><input type="radio" name="age" value="adult" id="adult_field" checked>Age 16+</td> </tr> <tr> <td>Membership, yearly</td> <td>£12</td> <td>£24</td> </tr> <tr> <td><input type="checkbox" class="extras" id="training">Training, 6 weeks</td> <td>£24</td> <td>£30</td> </tr> <tr> <td> <input type="checkbox" disabled checked> <input type="hidden" class="extras" id="insurance" value="checked">Insurance, yearly </td> <td>£15</td> <td>£25</td> </tr> <tr> <td> <input type="checkbox" disabled checked> <input type="hidden" class="extras" id="badges" value="checked">Badges, quarterly </td> <td>£2</td> <td>£2</td> </tr> <tr> <td> <input type="checkbox" disabled checked> <input type="hidden" class="extras" id="subs" value="checked">Subs, weekly </td> <td>£2</td> <td>£3</td> </tr> <tr> <td><input type="checkbox" class="extras" id="equipment">Equipment, weekly</td> <td>£2</td> <td>£2</td> </tr> </table> <p><input type="button" value="Calculate Fee" onClick="calculate_fee();"></p> <h3> </h3> <h2>Total On first day: £<span id="session">0</span>.</h2> <h3>Breakdown</h3> <p>Pro Rata Membership: £<span id="year">0</span> (Annually, due every January) <br> Training 6 Weeks: £<span class="result" id="training_fee">0</span> (One Off Payment) <br> Insurance: £<span class="result" id="insurance_fee">0</span> (Annually, due every September) <br> Badges: £<span class="result" id="badges_fee">0</span> Quarterly. <br> Subs: £<span class="result" id="subs_fee">0</span> Weekly <br> Equipment Hire: £<span class="result" id="equipment_fee">0</span> (Weekly, when needed) </p> </div> </div> </div> </body> </html>
That is javascript actually. I grabbed the code. I will try to get that working in wordpress in a sec. on my dev. server.
right .. fixed it... evidently, wordpress automatically blocks javascripts etc for security, so had to install a plugin called Scripts n Styles then just copied the script into there and added the shortcode to the page thanks for your help
heh, beat me to it. This is really intuitive and worked on my dev. server as well https://wordpress.org/plugins/css-javascript-toolbox/ same thing, different plugin basically.. glad I could help. Nigel
I have a free WordPress video training website that helps you with WordPress and cPanel. Maybe this would help you. Please let me know how we can help you? https://www.wpvideotraining.org