JQuery tooltips on dynamically generated page

I am trying to add a jQuery tooltip to a dynamically generated list, the text I want to display the tooltip is in the table, so my CSS tooltip does not work:

CSS hint .

I tried adding this jQuery hint to the page, it works on my local test page, but I think the problem has something to do with uniqur ids, and I'm not sure how to implement the bind all function described there:

"To link all goals to relevant content, only one line is required:

$(".tooltip-target").ezpz_tooltip();
Calling ezpz_tooltip()

in the class, it will attach a hover event to each element, and because of the naming convention, it will know what content to display.

Can someone help me understand what exactly I need to do to make this work on a dynamic page?

Page Euroworker customer order page . (You will need to add some items to the basket, click the "Home" button to the left of the bnav panel and click the small white "kjøp" button, then the orange "handlevogn" button.)

Thank.

+3
source share
3 answers

I believe that you can name jQuery(".tooltip-target").ezpz_tooltip();every time you add a new element (if they have a class tooltip-target), but I'm not sure if this is absolutely correct.

, , - , livequery. - :

jQuery(".tooltip-target").livequery(function(){
   j(this).ezpz_tooltip();
})
+4

, :

  • script : → www/public, ?
  • HTML W3C, DOM.
  • javascript ( jquery ? )
  • Firebug Opera Dragonfly.

( ) . ( ;))

+1

script simpletip.js . 404.

<script type="text/javascript" src="www/public/javascript/frontend/simpletip.js"></script>

javascript . firebug.

syntax error
[Break on this error] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"\n
simpletip.js (line 4)

container.getElementsByClassName is not a function
[Break on this error] $A(container.getElementsByClassName('productOptionsMenu')).each(
gzip.p...8031024 (line 4441)

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMViewCSS.getComputedStyle]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://media1.juggledesign.com/portfolio/js/jquery.js :: anonymous :: line 22" data: no]
[Break on this error] (no source for )

$("searchField").addClassName is not a function
[Break on this error] $('searchField').addClassName('quickSearch');
gzip.p...8031024 (line 4928)

, , , , .

+1
source

Source: https://habr.com/ru/post/1743164/


All Articles