I am trying to show some information inside a <div> as follows:
<div id="show_details" style="'display:block;' : 'display:none;'"> SHOW me </div>
choosing from a drop-down list for example.
<?php if ($books == 'art') { ?> <option value="art" selected="selected" id="art_indicator" onchange="(this.selected) ? $('#show_details').css('display','block') : $('#show_details').css('display','none');">Art</option> <?php } else { ?> <option value="art" id="art_indicator" onchange="(this.selected) ? $('#show_details').css('display','block') : $('#show_details').css('display','none');">Art</option> <?php } ?>
and the full code as shown below
<tr> <td>Book Option</td> <td> <select name="books"> <?php foreach ($others as $other) { ?> <?php if ($other == $other['other']) { ?> <option value="<?php echo $other['other']; ?>" selected="selected"><?php echo $other['title']; ?></option> <?php } else { ?> <option value="<?php echo $other['other']; ?>"><?php echo $other['title']; ?></option> <?php } ?> <?php } ?> <?php if ($books == 'art') { ?> <option value="art" selected="selected" id="art_indicator" onchange="(this.selected) ? $('#show_details').css('display','block') : $('#show_details').css('display','none');">Art</option> <?php } else { ?> <option value="art" id="art_indicator" onchange="(this.selected) ? $('#show_details').css('display','block') : $('#show_details').css('display','none');">Art</option> <?php } ?> </select></td> </tr> <div id="show_details" style="'display:block;' : 'display:none;'"> SHOW me </div>
Is there any way to fix this?
omc11 source share