The following script works fine (i am not familiar with Javascript). I wish to change the para.textcontent to display a form (paypal button). if I inset the form in the para.textconten field it does not work. Any help? I have shown the button code below the script.
<tr>
<td>
<label for="weather">Select the weather type today: </label>
<select id="weather">
<option value="">--Make a choice--</option>
<option value="sunny">Sunny</option>
<option value="rainy">Rainy</option>
<option value="snowing">Snowing</option>
<option value="overcast">Overcast</option>
</select>
<p></p>
<script>
const select = document.querySelector('select');
const para = document.querySelector('p');
select.addEventListener('change', setWeather);
function setWeather() {
const choice = select.value;
if (choice === 'sunny') {
para.textContent = 'It is nice and sunny outside today. Wear shorts! Go to the beach, or the park, and get an ice cream.';
} else if (choice === 'rainy') {
para.textContent = 'Rain is falling outside; take a rain coat and an umbrella, and don\'t stay out for too long.';
} else if (choice === 'snowing') {
para.textContent = 'The snow is coming down — it is freezing! Best to stay in with a cup of hot chocolate, or go build a snowman.';
} else if (choice === 'overcast') {
para.textContent = 'It isn\'t raining, but the sky is grey and gloomy; it could turn any minute, so take a rain coat just in case.';
} else {
para.textContent = '';
}
}
</script>
</td>
</tr>
<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="DJUTWCWH7R9FJ" />
<table summary=''>
<tr><td><input type="hidden" name="on0" value="Rack Size" /></td></tr><tr><td><select name="os0">
<option value="Jr. Enlisted">Jr. Enlisted $43.99 USD</option>
<option value="Sr. Enlisted">Sr. Enlisted $45.99 USD</option>
<option value="Stateroom">Stateroom $47.99 USD</option>
<option value="Submarine Crew">Submarine Crew $43.99 USD</option>
</select> </td></tr>
</table>
<input type="hidden" name="currency_code" value="USD" />
<br style='line-height: 10px' />
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_cart_LG.gif" style="width:100px; height:25px;" name="submit" alt="PayPal - The safer, easier way to pay online!" />
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1" />
</form>