Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [jQuery] check attribute

  • This topic is empty.
Viewing 1 post (of 1 total)
  • Author
    Posts
  • #28015
    Makeshift
    Member

    Hey guys, I wanted to know if there was a way I can check if an ‘img’ tag has an ‘alt’ attribute, and if it doesn’t have an ‘alt’ attribute already set, it sets one?

    Code:

    having the jQuery automatically turn it into this:

    Code:

    The reason I ask is because I found out that if there is no alternate text set for images, it is becomes an error when validating.

    thanks for any help.

Viewing 1 post (of 1 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.