Timeline for Issues trying to get an element by id
Current License: CC BY-SA 3.0
11 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 6, 2016 at 22:07 | comment | added | MrSamuel | Brilliant! Answered! | |
| Feb 6, 2016 at 22:07 | vote | accept | MrSamuel | ||
| Feb 6, 2016 at 20:46 | comment | added | Rituparna sonowal | Second solution added. Hope you don't forget to accept the answer if it is useful :) | |
| Feb 6, 2016 at 20:44 | history | edited | Rituparna sonowal | CC BY-SA 3.0 | added 397 characters in body |
| Feb 6, 2016 at 20:27 | comment | added | MrSamuel | Just realized I only want to add this script for that page, so I've been trying to change my code to achieve that, but seems to be crashing wordpress. Here is what I am trying, what am I missing? (see revised question above). Thanks! | |
| Feb 6, 2016 at 19:41 | comment | added | MrSamuel | You got it! InOrCm was in this random html that wordpress wasn't seeing as html. I removed all the spaces and it sees it as html now. Why these are there is a long story... One other quick question, there is still one error coming up when that page loads, what do you think that might be due to? | |
| Feb 6, 2016 at 19:28 | comment | added | Rituparna sonowal | js file is loading in footer which is okay. But where is your "InOrCm".. I didn't find that in your actual html but in the code block. what are you doing I didn't get.. why some random html are showing in your page?? | |
| Feb 6, 2016 at 19:15 | comment | added | MrSamuel | Here is the page I am testing on: tall.life/javascript-testing-2-2 | |
| Feb 6, 2016 at 18:43 | comment | added | Rituparna sonowal | That means your html has no input text field with id "InOrCm". Can you share your html part which have the input field? Use wp_enqueue_script with in_footer argument true that will load your js in footer. Let me know if need more help | |
| Feb 6, 2016 at 18:16 | comment | added | MrSamuel | Thanks for responding, Rituparna. This is the error I get for the getglementbyid line: Uncaught TypeError: Cannot set property 'value' of null. It seems that when the javascript is in my theme/js folder, element ids aren't recognized. Whereas if the javascript is directly at the bottom of my wordpress post, it works fine. | |
| Feb 6, 2016 at 17:53 | history | answered | Rituparna sonowal | CC BY-SA 3.0 |