SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,107
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Post Adding class to IMG element dynamically

    Hi, I need some help please,i want to add a class to the element IMG but the IMG element is loaded dynamically by the google map.

    i tried

    Code:
      $('img').addClass('mytest');
    but it's not working.

    Thank you in advance.

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,701
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by jemz View Post
    i want to add a class to the element IMG but the IMG element is loaded dynamically by the google map.
    ...
    but it's not working.
    That won't work because google doesn't use the img tag for such things. Instead, they use class names to show such images.

    You could attempt to override the CSS that google uses, to you could go back to the original advice from that other thread where you are advised to use Google's preferred solution of using a custom SVG image instead.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Wizard
    Join Date
    May 2012
    Posts
    1,107
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by paul_wilkins View Post
    That won't work because google doesn't use the img tag for such things. Instead, they use class names to show such images.

    You could attempt to override the CSS that google uses, to you could go back to the original advice from that other thread where you are advised to use Google's preferred solution of using a custom SVG image instead.

    Thank you paul.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •