Closed Thread
Results 1 to 2 of 2

Thread: New to jQuery... need help

  1. #1
    Anicho is offline Newbie
    Join Date
    Nov 2009
    Posts
    14
    Rep Power
    0

    New to jQuery... need help

    <script type="text/javascript">
    //<![CDATA[
    $("#submenu a:contains('something')").addClass("newclass");
    //]]>
    </script>

    While that works, I don't want to add a class I want to add an ID.
    But this won't work.

    <script type="text/javascript">
    //<![CDATA[
    $("#submenu a:contains('something')").addID("newid");
    //]]>
    </script>

    I'm new to jQuery I need help

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    SeanStar's Avatar
    SeanStar is offline Learning Programmer
    Join Date
    Nov 2009
    Posts
    32
    Rep Power
    0

    Re: New to jQuery... need help

    Quote Originally Posted by Anicho View Post
    While that works, I don't want to add a class I want to add an ID.
    You Can't... IDs are only usable with their tags.
    .addClass adds a class to a tag which may have another class.
    If there was an .addID method it would let you have more than one ID per tag, which is not valid.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Jquery help
    By ahmed in forum JavaScript and CSS
    Replies: 1
    Last Post: 06-12-2011, 11:48 AM
  2. Replies: 1
    Last Post: 04-22-2011, 11:18 AM
  3. PHP / Jquery Help
    By tridiantgames in forum PHP Development
    Replies: 2
    Last Post: 08-31-2010, 09:40 PM
  4. jQuery help
    By Jaan in forum JavaScript and CSS
    Replies: 7
    Last Post: 03-31-2009, 06:59 AM
  5. jquery kid
    By amrosama in forum The Lounge
    Replies: 11
    Last Post: 02-27-2009, 01:45 PM

Tags for this Thread

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