Forums

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

Home Forums JavaScript jQuery toggleClass or addClass problem

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #24916
    arkader
    Participant

    Hi everyone !
    I’m having some trouble with the jQuery library
    I would like to vanish some text when i click on a link
    I tried with addClass or toggleClass, but it doesn’t works
    I want to make disapear text included in the class .slot_text
    here is my code
    ( sorry for my english , i’m very bad)

    #57955
    apostrophe
    Participant

    Why bother with adding and removing classes when you can use the hide function instead?

    Code:
    $(function() {
    (‘a#link’).click(function(){
    (‘.slot_text’).hide();
    });
    });
    #57978
    Stack
    Member

    You wouldnt be changing the css at all. you would simply change the display value to none. it does not alter the css file in any way. simply set a display: none property to the element

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