How to display marked / verified data in a jQuery dropdown. Basically my problem is that I want to display the back checked value in the jquery dropdown that is stored in the database.
I tried using the attr selected in my javascript, something like this.
<script type="text/javascript"> $(document).ready(function() { $("#<?php echo $bnum; ?>").dropdownchecklist({width: 300}); </script>
The value for the checkbox that I am extracting from the sql procedure looks something like this:
For room 501: 2
What I'm trying to do now is when a user clicks on a page. The drop-down list checklist is marked with a value retrieved from the database.
Below is the code for the room rows that contains jQuery for each row
<select id="<?php print $bnum; ?>" multiple="multiple" name="status[]" > <option value="0"></option> <?php <option value='<?php echo $rowsakh['diet_id'] . '|' . $bnum; ?>' "selected" : ''> <?php echo $rowsakh['diet_name']; ?></option> <?php } ?> </select>
Thanks in advance, im new in javascript. Can someone help me find out how to display the marked item in the jQuery dropdown that is retrieved from the database.
source share