Jquery div name selector

Discussion in 'JavaScript' started by nevta, Nov 25, 2012.

  1. #1
    hi there
    i wanna select div using name attribute via jquery. I know div not support name attribute.
    <div name=city> </div>
    is it posible? if yes please share this code.
    Thanks
     
    nevta, Nov 25, 2012 IP
  2. Rukbat

    Rukbat Well-Known Member

    Messages:
    2,908
    Likes Received:
    37
    Best Answers:
    51
    Trophy Points:
    125
    #2
    Since divs have no name attribute, you can't refer to them by a name attribute. It's like referring to a person by the color of their wings. Or a bird by how many teeth it's had pulled.

    So, no, it's not possible.
     
    Rukbat, Nov 25, 2012 IP
  3. deathshadow

    deathshadow Acclaimed Member

    Messages:
    9,732
    Likes Received:
    1,999
    Best Answers:
    253
    Trophy Points:
    515
    #3
    Yeah, pretty much that's ID's job... 'modern' code the only thing NAME should be used for is META tags and server side for form elements -- accessing elements by 'name' even in a form is old outdated nyetscape 4 style nonsense...

    EVEN when using the fat bloated train wreck of idiocy known as jquery.
     
    deathshadow, Nov 27, 2012 IP