tags:

views:

25

answers:

3

hi, I am trying to call my function loadPopup() although failing using JQuery v1.3.2. any suggestions? many thanks,

$(this).find("a").each(function(i) {
    if ($(this).hasClass("selected") == false) {

        $(this).css("background-color", "#efefef");
        alert(1);
        loadPopup();
        alert(2);                     

    }
})

function loadPopup() {
    alert("");       
}
A: 

sorry, didnt paste the whole thing.

          $(this).find("a").each(function(i) {
              if ($(this).hasClass("selected") == false) {

                  $(this).css("background-color", "#efefef");
                  alert(1);
                  loadPopup();
                  alert(2);                     

              }
          })
James Radford
Don't post this as an answer. Edit your original question.
GenericTypeTea
The code looks fine - can you paste the HTML you are using?
Ben Clayton
ok sorry, couldnt see where to edit.. see the html here http://jamesradford.net/so/demo.htm
James Radford
A: 

If you're starting at the root looking for all <a> links, you should replace this:

$(this).find("a").each(function(i) {

with this:

$("a").each(function(i) {

And you can further slim it down by using selectors to your advantage. In this case combine the :not() with the .class selector to get all <a> without the class, like this:

$("a:not(.selected)").css("background-color", "#efefef").each(function() {
  loadPopup();
});

You can give it a try here.

Nick Craver
wow, whats this..(?) I need to call the loadPopup when hovering over any of the 6 divs.
James Radford
@James - Do you mean like this? http://jsfiddle.net/nick_craver/DFsBJ/1/ (uncomment out the alert to see that it works)
Nick Craver
i need the corresponding UrgencyMessage div to become visible when hovering over any of the 6 boxes.
James Radford
@James - I'm not sure *exactly* what you're after on the background color, this can probably be done in CSS, but this should work for the `<div>` showing: http://jsfiddle.net/nick_craver/DFsBJ/3/
Nick Craver
thank you, that is what I want but can you see how the popup is cut shot because of the overflow: hidden property on OutboundDaySliderContainer? -- this is the problem I'm experiencing.
James Radford
@James - Just remove the `overflow: hidden` like this: http://jsfiddle.net/nick_craver/DFsBJ/4/
Nick Craver
we need to keep the overflow: hidden property.. hence the problem.
James Radford
@James - what about a fixed position then: http://jsfiddle.net/nick_craver/DFsBJ/5/
Nick Craver
it needs to stay hidden because on the left and right we have additional boxes that are scrolled into view on the users request.
James Radford
any ideas? Thanks,
James Radford
is this possible using jquery? (see Tips 3) http://demos111.mootools.net/Tips
James Radford
@James - Check out the demos section here: http://blog.jqueryui.com/2010/05/jquery-ui-19m1-tooltip/
Nick Craver
thank you will this work with v1.3.2? thanks
James Radford
@James - there are *many* tooltip plugins, and most have a 1.3.2 version as well, for example: http://www.webdesignbooth.com/15-jquery-plugins-to-create-an-user-friendly-tooltip/
Nick Craver
looks like this might be the best bet but im strugglying to get text into the popup except for hard coding it into the content: 'hello' property http://craigsworks.com/projects/qtip/docs/tutorials/#position
James Radford
example of my attempt here: http://jamesradford.net/so/qtip.php
James Radford
A: 

It seems that you are not binding any event on the href. Thats the reason, even on click of the link, your loadPopup() is not being called.

I hope the following code can help you out :

$(this).find('A.selected').unbind('click').bind('click',function() { 
    loadPopup();

    });

You can place either $(this) in above code, if you are querying inside table row etc. collections or you can use directly : $('A.selected').unbind.....

Siva Gopal