How to add tooltip to dropdown values?

I have 5 fields with three dropdown values as High, Medium and Low. I want to add three tooltips to these three values. I have tried doing it with jQuery in view.edit.php and view.detail.php but with no success. In edit view I am not able to select the three dropdown values, instead the same title value is coming for all three vlaues. I am new to jQuery, so I need help. Thank You in advance.

  • Hi paul

    I got the solution.

    the code that I wrote in view.edit.php was like this:

    $("#complexity_c option:eq(0)").attr("title"," Content 1");

    $("#complexity_c option:eq(1)").attr("title","Content 2");

    $("#complexity_c option:eq(2)").attr("title","Content 3");

    Where complexity_c is the id of the dropdown field and Content 1, Content 2, Content 3 are the tooltip values that are to be shown when we hover the mouse on the values of the dropdown.

    For view.detail.php, the code was as follows:

    var status = $('#complexity_c').val();

      switch(status){

         case 'High':

                    $("#complexity_c").parent().tooltip().attr("title","Content 1");

                    break;

                    case 'Medium':

                    $("#complexity_c").parent().tooltip().attr("title","Content 2");

                    break;

                    case 'Low':

                    $("#complexity_c").parent().tooltip().attr("title","Content 3");

                    break;

      }

    where High, Medium and Low are the values of the dropdown field.

    Hope this help you.