Tuesday, 15 May 2012

jquery on each bind text for parent attribute name values -


I'm trying to do my tooltip, which should show the value of the original element name value:

I am adding new divis after my anchor tag, and I am trying to bind the text value of the parent anchor name value ...

But only me the last name value in all of my ( Tooltip 3333333333333) is getting (.tooltipContainer) div? Can anyone help solve it?

  HTML:  

issue $ (".trytipContainer") Elements are added to the class instead of tooltipContainer instead of just one pair and it sets its html as the parentAttrNameValue value, so when the last item is processed So its value is set to all element.

Instead you can add the element given below, here we create html for the new element when it is making.

  $ (document) .ready (function () ($ ("(custom tooltip"). Each (function (i) {var customToolTipName = $ (this) .attr ('name '); Var parentAttrNameValue = $ (this) .Parent (. Find (".customToolTip"). Attr (' name '); // alert (parentAttrNameValue); $ (' 

Demo:

Not too sure What is parentAttrNameValue , it is similar to customToolTipName


No comments:

Post a Comment