Please Log-in or Register to get full access to the forums.


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] jQuery .each() not working, any other ways?
1st January, 17:08 (This post was last modified: 1st January 17:14 by xMoltenX.)
Post: #1
[Solved] jQuery .each() not working, any other ways?
As the title says, for me and some other ppl .each() does not work :X No idea why that is, but... anyways I was just wondering if there are any other ways to do the code? This is where I am:

JS Code
$('#streamer').each(function() {
        $(this).qtip({
            content: {
                title: $(this).data("tooltip"),
                text: $(this).data("qtip-text")
            },
            style: {
                tip: false,
                classes:qtipstyle
            },
            hide: {
                delay:200,
                fixed:true
            },
            position: {
                at: "center",
                my: "center"
            }
        });
    });
Find all posts by this user
Quote this message in a reply
2nd January, 08:33
Post: #2
RE: jQuery .each() not working, any other ways?
Hi,

see this example : http://jsfiddle.net/sjQvR/1/

Only the first one works, because you're using an id selector (#) in the each. If you change this and use a class or element selector, this should work.
Find all posts by this user
Quote this message in a reply
2nd January, 09:07
Post: #3
RE: jQuery .each() not working, any other ways?
Yes, ID's are (or at-least, should be) unique to a singular element, and for this reason the selector call:
JS Code
$('#streamer') // Maps to document.getElementById('streamer')

... returns a single element, even if multiple elements have the same ID.

Use a class based selector instead: http://api.jquery.com/class-selector/ (might be a good idea to read up on the other common selectors, too)
Visit this user's website Find all posts by this user
Quote this message in a reply
8th November, 06:46
Post: #4
RE: [Solved] jQuery .each() not working, any other ways?
The jQuery Each is not applied correctly here. No 2 element should be having same id. Use class to assign same class to them and do $(".mycss") in jquery.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Latest version not jQuery 3.0 compatible caldjeff 1 1,323 30th August 09:57
Last Post: Martho
  Try to customize the 'tip', but cannot find a proper event handler to call jquery.css blao 2 581 5th February 08:09
Last Post: binhluan2802
  qTip not working when using onmouseover attribute StefanP075 0 518 8th December 10:44
Last Post: StefanP075
  http://qtip2.com/ website not working? Is this project alive? Upgrading from 1.0 to 2 brook@ 0 779 24th August 15:13
Last Post: brook@
  qtip2 is not working on dynamically added element aniket27 0 1,410 2nd July 12:27
Last Post: aniket27
  'too much recursion' error on hoverover with qtip 2.2.1 and jquery 1.8.2 paulred2 0 1,573 14th April 11:56
Last Post: paulred2
  Tooltip clicks not working after refresh nwbearcat1998 2 1,578 12th April 20:22
Last Post: nwbearcat1998
  Focus not working penone 0 1,471 31st January 21:25
Last Post: penone
  qTip2 v2.2.1 not working in IE8 or Compatibility Mode waqas.ahmed 1 1,766 17th June 11:41
Last Post: wesleywheel15
  unable to get qtip set working yawnmoth 0 1,585 17th March 12:19
Last Post: yawnmoth



User(s) browsing this thread: 1 Guest(s)