I'm trying to automate my ribbons for my GTA ONLINE crew website, and rather than having to hand-code; I create checkboxes with "ultimate-member" and then use javascript to check if a field is checked and display the image.
Here's what I have
<script>
if (document.getElementsByName("platform").value === "Medal Of Honor" && document.getElementsByName("platform").checked ) { {
document.getElementByID().innerHTML ='<img src="http://www.8492nd.org/img/awards/Medal-Of-Honor.png" alt="" />';
}
</script>
<h1>code beta</h1>
<input type="checkbox" name="platform[]" value="Medal Of Honor" checked />Medal of Honor
<div id="awards-ribbons">
</div>
I tried to put the code inside the div, and simply have it write the image out based on which boxes are checked. problem I ran into is that the input doesn't have an ID or Class attribute; and I cannot change it. If I could locate the PHP of "ultimate-member" I would add an id based on the value of checkbox. Then I could use the getElementById(id).checked and I'll be good to go.
Inside of your if statement, the
document.getElementById()
expression doesn't have an argument passed to it. You should pass to it the id of the element that you want to change.