Unable to get Alert function to consistently work with backend widget with latest WP

I changed the name of the back-end widget reference to “carousel_edit_url_for_newspro/backendwnisoform.php” in order to isolate the problem down to its essentials.

The code below works, praise G-d. I should then be able to use this sort of code in the main stream of the program development to get the drop-down menus to work fine, G-d willing:

?><br>
<select id="<?php echo esc_attr( $this->get_field_id( 'myselect' ) ); ?>" onchange="myFunction126(this.id, this.value)">
<option value="Audi">Audi
<option value="BMW">BMW
<option value="Mercedes">Mercedes
<option value="Volvo">Volvo
</select>

<p id="<?php echo esc_attr( $this->get_field_id( 'mydemo' ) ); ?>">Hi There!</p>

<script type="text/javascript">
function myFunction126(thisid126, thisvalue126) {
var x126 = document.getElementById(thisid126).value;
var y126 = thisvalue126;
document.getElementById(id="<?php echo esc_attr( $this->get_field_id( 'mydemo' ) ); ?>").innerHTML 
= "You selected: " + x126;
alert ("New selection!  x126 = " + x126 + " and y126 = " + thisvalue126);
}
</script>

For those wanting the latest script that was working correctly (just on this one issue isolated out), it is available from:

Zip file containing the plugin with the one element working just fine

Leave a Comment