Question

I have a listbox. My listbox shows all my IDs from a database but I want to create a listbox, and when I mouseover it the tooltip shows the name associated with ID in the database. Here is the code of my listbox :

$pdo = new PDO('mysql:host=localhost;dbname=ohmega', 'zabbix', 'lol');
        #Set Error Mode to ERRMODE_EXCEPTION.
        $pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);  
        $stmt = $pdo->prepare('Select * from taches');
        $stmt->execute();

                ?>  
                <span id="productSKUHelp" class="helpTip questionMark"></span>




                    <select id="tache" name="tache">        
                    <?php

                        $stmt->execute();
                        while($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
                            echo '<option>'.$row['tacId'].'</option>';
                        }
                    ?>
                    </select> 

So how do I put a tooltip linked with my Id of my listbox?

Was it helpful?

Solution

Let say you have generated following select option;

<select multiple class="tooltip">
    <option title="potato">1</option>
    <option title="tomato">3</option>
    <option title="apple">40</option>
    <option title="strawberry">100</option>
</select>

You can use following js;

$(".tooltip").tooltip();

Here is working demo: jsfiddle

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top