Results 1 to 11 of 11

Thread: Where is the difference between ID and CLASS?

  1. #1
    Join Date
    Jul 2007
    Location
    Malaysia
    Posts
    80
    Rep Power
    0

    Where is the difference between ID and CLASS?

    hm I remember there is a thread about ID n CLASS here somehow it is lost (n i too lazy to dig it out), so i make a new thread here ask the same question again

    where is the difference between id n class? when to use id when to use class? i experimentally used them to hold several kind of properties n both of them works pretty well, cant see the different??
    Last edited by kaisology; 21-03-2008 at 01:21 PM.

  2. #2
    Join Date
    Jan 2007
    Location
    Petaling Jaya
    Posts
    867
    Rep Power
    172
    a very simple explanation for understanding:
    ---
    ID is a unique and therefore can only exist only 1 time in a single html file. all the attribute that's being declare in css for ID can only be use for a single element.

    CLASS is the opposite of ID. All the attribute that's being declare in css for CLASS can be use multiple times on any html elements.
    ---

    that's the definition, both actually does work well and see no difference as u said but if u check with the web standard checker, those html which has 2 same ID in a single html will return error. That's for web standard

    and is better that u differentiate ID and CLASS properly as believe me, is very useful when u do some CSS modification in the future. "changing an ID attribute wont change anything else but changing CLASS attribute will affect others"

    hope my explanation is clear

  3. #3
    Join Date
    Jul 2007
    Location
    Malaysia
    Posts
    80
    Rep Power
    0
    thanks yes clear enough!!!

  4. #4
    Join Date
    Jun 2001
    Location
    Mystic Kingdoms
    Posts
    2,749
    Rep Power
    277
    id vs class play big roll in ajax

  5. #5
    Join Date
    Jun 2007
    Location
    Kuala Lumpur
    Posts
    165
    Rep Power
    152
    haha simply description,

    u lost ur id card, it doesn matter, u still can go for class..but there's no class, how u study? lol..jk..

    just id represent for 1 thing, like ur id card never able to share with other, but class, just like u're planning to attend a programming class, there's thousand sections of classes where teaching programming (for you to choose) and all are also known as programming class. haha..hope u understand what am i explaining.

    lol..
    Hash here..

  6. #6
    Join Date
    Jul 2007
    Location
    Malaysia
    Posts
    80
    Rep Power
    0
    Quote Originally Posted by mysticmind View Post
    id vs class play big roll in ajax
    what role they r playing in ajax?
    haha here i comes another question: difference between 'ajax' and 'javascript'?

  7. #7
    Join Date
    Mar 2008
    Location
    Sabah
    Posts
    51
    Rep Power
    141
    Quote Originally Posted by kaisology View Post
    hm I remember there is a thread about ID n CLASS here somehow it is lost (n i too lazy to dig it out), so i make a new thread here ask the same question again

    where is the difference between id n class? when to use id when to use class? i experimentally used them to hold several kind of properties n both of them works pretty well, cant see the different??
    I was wondering what ID and CLASS are you talking about?
    Yipguseng has explain it well

    You can learn about AJAX in OpenDNS

  8. #8
    Join Date
    Mar 2008
    Location
    Sabah
    Posts
    51
    Rep Power
    141
    For some reason, I can't even edit my own post!!!

    Anyway,
    AJAX doesn't enhance Javascript. It relies on it. Javascript is a client side technology. It is purely run on the browser. AJAX can be thought of as interface between the technologies.
    AJAX just uses javascript to communicate with the server in the form of XML. That's all. There's no magical difference between javascript and AJAX, AJAX is an implementation of javascript.

    EDIT: the correct link is this: W3schools
    Last edited by Monie; 22-03-2008 at 05:48 PM.

  9. #9
    Join Date
    Jul 2007
    Location
    Malaysia
    Posts
    80
    Rep Power
    0
    Quote Originally Posted by Monie View Post
    For some reason, I can't even edit my own post!!!

    Anyway,
    AJAX doesn't enhance Javascript. It relies on it. Javascript is a client side technology. It is purely run on the browser. AJAX can be thought of as interface between the technologies.
    AJAX just uses javascript to communicate with the server in the form of XML. That's all. There's no magical difference between javascript and AJAX, AJAX is an implementation of javascript.

    EDIT: the correct link is this: W3schools
    Still dont get what you meant...but thank you for the explaination at least you give me some idea d

  10. #10
    Join Date
    Apr 2004
    Location
    Cheras, Selangor.
    Posts
    457
    Rep Power
    0
    Javascript and AJAX is no different at all. That why i wonder after quite some time leaving for a short time World Wide Web and suddenly come back heard about AJAX/WEB 2.0 etc. Look at the coding and realised that it is the same Javascript with wide application use only. Long time ago has build this kind of code. Just never give a name for it..haha

  11. #11
    Join Date
    Apr 2004
    Location
    Ampang
    Posts
    18
    Rep Power
    0
    What being said from the first reply is true. Id should be unique in per page, i.e can only be use once. Where as class can be use repetitively.

    Some might not see the importance of this, as they tend to use id instead of class again and again.

    As for me, I followed this rule strictly since I'm using jQuery, a javascript framework for my works. On events such as, click, submit, etc, jQuery heavily depending on id and classes.

    I believe for those who work a lot with Javascript, to say the least, would see the importance in differentiating id and class.
    ""If you must break the law, do it to seize power: in all other cases observe it." - Julius Caesar

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Difference between html and dhtml
    By neeraj in forum Website Design
    Replies: 28
    Last Post: 25-06-2019, 12:52 PM
  2. Difference between http:// and https://
    By ladycooper in forum Website Design
    Replies: 2
    Last Post: 07-10-2009, 08:52 AM
  3. Vinyl Sticker Printing Makes a Big Difference
    By muqtada123 in forum Other Webmaster-related Services and Promotion
    Replies: 0
    Last Post: 19-06-2009, 06:21 AM
  4. what is the difference between trackback and ping?
    By ladyfiesta in forum Blogging Discussion
    Replies: 3
    Last Post: 09-05-2007, 03:59 AM
  5. What's the difference between Flash and Director
    By zaimlah in forum Website Design
    Replies: 12
    Last Post: 18-02-2004, 12:00 AM

Posting Permissions

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

Search Engine Optimization by vBSEO 3.5.0 RC1 PL1

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112