I got a Paypal button on my webpage includes this generated code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top" class="center-align" id="paypal">
<input type="hidden" name="cmd" value="_s-xclick" >
<input type="hidden" name="hosted_button_id" value="XMMPHFAWFLLRG">
<input type="image" src="https://www.paypalobjects.com/de_DE/DE/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="Jetzt einfach, schnell und sicher online bezahlen – mit PayPal." ">
<img alt=""
By clicking on the "buy now" logo, JS should check, if an option is selected. I am using the Materialize Framework, and that's the select field:
<select>
<option value="0" disabled selected>Kategorie</option>
<option value="1">Beauty</option>
<option value="2">Technik</option>
<option value="3">Deko</option>
</select>
So no ID or class names, it's the only select on the page.
My Javascript, which I tried looks like that:
function isSelected() {
if (getElementsByTagName("select").value == '0') {
alert("Bitte eine Kategorie auswählen!");
}
}
How do you guys think, I could solve the problem? I checked similiar questions, but didn't get it solved.