user782104
user782104

Reputation: 13545

How to create a textbox that display message when mouseover?

I have a sql query that obtain a string called description from the database

Also , i have a table that contain a mail list

I would like for each mail list name, when the mouse over it, it display a text block that contain the description

Are there any plugin , or how to do that? Thank you.

Upvotes: 0

Views: 1050

Answers (3)

Alex Reynolds
Alex Reynolds

Reputation: 96937

I use a jQuery plug-in called TipTip, which is very simple to implement.

Upvotes: 1

nandu
nandu

Reputation: 779

You can use the title attribute of html for that or make use of tooltip . You can easily find an example of tooltip. But if you trying to fetch the data from your db on the run time..i would say thats a bad idea

Upvotes: 1

Ohgodwhy
Ohgodwhy

Reputation: 50787

The PHP(for the query). You can use whatever, this is an example.

<?php
  $q = 'your sql query'
  $query = mysql_query($query)
  while($row = mysql_fetch_array($query)){
?>
  <div class="email-list-name-<?=$row['id']?>"> <?=$row['email-list-name']?> </div>
  <div class='description-for-email' style='display:none;'><?=$row['description']?></div>  
<?php  } ?>

The jQuery:

$(function(){
  $('div[id^="email-list-name"]').click(function(){
    $('.description-for-email').hide(); //hide all message displays
    $(this).next('.description-for-email').show();  //show the next description for our email we clicked
  });
});

You didn't really provide any other information, so I just threw together a general example.

Upvotes: 1

Related Questions