Forums

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

Home Forums JavaScript jQuery – ATTRIBUTE SELECTOR

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33209
    aoeui
    Participant

    hi,

    learning jQuery but can’t figure out how to select all elements except one with certain attribute
    want to hide all images except the one with alt=”2″

    http://krsiak.cz/temp/css-tricks/attribute-selectors/

    something is wrong with this part I believe

    $("[alt!='2']").hide();




    Attribute Selectors





    1
    2
    3







    #81993

    Hey, I think I was able to get this to work how you wanted. Try this for your click function:


    $('button').click(function() {

    $('img[alt!=2]').hide();

    });
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.