I am using Bootstrap v3.3.5 and JQuery v1.11.3 .
I have a select list that when a value is selected, I would like the placement and css class of a tooltip to change.
I have searched Google & SO and read many SO posts, but the many attempts I have made fail. For example, this did not work for me.
Here is my html code:
<select id="id_cover_letter_type" name="cover_letter_type">
<option value="0" selected="selected">I will write my own data</option>
<option value="1">Standard Cover Letter</option>
....
</select>
<i id="id_icon_id_cover_letter_details_second_paragraph" class="fa fa-lightbulb-o blue_color icon_size26 verticalAlignTop" data-original-title="" title="" aria-describedby="tooltip229278"></i>
Here is my jquery code:
I have included the commented out attempts that I have made to change the data-placement of the tooltip (taken from other posts) that did not work for me.
$("#id_icon_id_cover_letter_details_second_paragraph").tooltip({'html': true, 'placement': 'bottom', 'title': '{% trans "Paragraph 2" %} <br /><br /> {% trans "This should detail why you want the job." %} <br /><br /> {% trans "Explain how your qualifications and career plan match the advertised position." %} <br /><br /> {% trans "The details you provide here should display that you have researched the employer, what the employer and industry are seeking and that you understand what the job requires." %}'});
if ( $('#id_cover_letter_type').val() == '0' ) {
// the following code did not work.
//$('#id_icon_id_cover_letter_details_second_paragraph').data('bs.tooltip').options.placement = 'left';
// the following code did not work.
//$('#id_icon_id_cover_letter_details_second_paragraph').tooltip({ placement: 'left' });
// the following, destroying, appling the placement and then showing the tooltip did not work.
//$('#id_icon_id_cover_letter_details_second_paragraph').tooltip('destroy');
//$("#id_icon_id_cover_letter_details_second_paragraph").tooltip({'placement':'left'});
//$("#id_icon_id_cover_letter_details_second_paragraph").tooltip('show');
// applying the placement and the showing the tooltip did not work.
//$("#id_icon_id_cover_letter_details_second_paragraph").tooltip({placement : 'left'}).tooltip('show');
} else {
// the following code did not work.
//$('#id_icon_id_cover_letter_details_second_paragraph').data('bs.tooltip').options.placement = 'bottom';
// the following code did not work.
//$('#id_icon_id_cover_letter_details_second_paragraph').tooltip({ placement: 'bottom' });
// the following, destroying, appling the placement and then showing the tooltip did not work.
//$('#id_icon_id_cover_letter_details_second_paragraph').tooltip('destroy');
//$("#id_icon_id_cover_letter_details_second_paragraph").tooltip({'placement':'bottom'});
//$("#id_icon_id_cover_letter_details_second_paragraph").tooltip('show');
// applying the placement and the showing the tooltip did not work.
//$("#id_icon_id_cover_letter_details_second_paragraph").tooltip({placement : 'bottom'}).tooltip('show');
}
Also, if someone can tell me the answer to change the css of the tooltip to class name custom-tooltip-styling123
, that would be fantastic.
EDIT
Here is a jsfiddle. This is only my 2nd fiddle, and I don't know how to add in the bootstrap to make the tooltip display.