jquery - For each for tooltip change placement on click of another button -


I have two buttons, one click and this has changed the direction of the bootstrap tooltip and then the opposite is the other I tooltip With the first instance of the element to work on it, I can only manage it to manage, otherwise not. I do not remember for every function, but I can not understand it at all.

Demo:

Q: Get all the examples, not just the first example, tooltip to work.

  $ (document) .ready (function () {var tippy = $ ('.class [data-hover = "tooltip"]') (trigger: 'hover', container: ' Body (''}); $ ('change-left-left'). Click (function (e) {tippdata ('b tooltip'). Options.placement = 'left'; e.preventDefault ();}) ; $ ('Change-dir-right'). Click (function (e) {tippy.data ('bs.tooltip'). Options.placement = 'right'; E.Pravant default ();}); });  

HTML

  & lt; A href = "#" class = "btn btn-block btn-default change-dir-left" & gt; Tooltip Change Directions Left & lt; / A & gt; & Lt; A href = "#" class = "BTN BTN-Block BTN-Default Change - Direre-Right" & gt; Change tooltip guidelines & lt; / A & gt; & Lt; Hour & gt; & Lt; Div class = "wrapper" & gt; & Lt; Button type = "button" class = "btn center-block btn-default" data-hover = "tooltip" title = "m" & gt; Tooltip & lt; / Button & gt; & Lt; Br> & Lt; Button type = "button" class = "btn center-block btn-default" data-hover = "tooltip" title = "m" & gt; Tooltip & lt; / Button & gt; & Lt; / Div & gt;  

try it

  $ ('.- Dir-left '). Click (function (e) {tippy.each (function () {$ (this) .data ('bs.tooltip'). Options.placement = 'left';}); e.preventDefault ();}); $ ('Change-direction-right'). Click (function (e) {tip (function () ($ (this) .data ('b.Toltip'). Options.placement = 'right';}); E.preventDefault ();});  

Comments