• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HTML Label field's "for" attribute problem

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys,

I have the following HTML content



I wanted the change the label text from javascript method. The labels for attribute is pointing towards the TextBox.
The Problem is I cannot add id attribute for label.(This code is auto generated from some custom tags). How do I can change the label for the corresponding TextBox?

Please give me your comments,
Mahendran
[ March 17, 2008: Message edited by: Mahendran Shanmugam ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Custom tags that don't let you specify basic and essential HTML attributes like id are not something I'd consider using. Do you have control over these tags?

If not, then you'll need to use DOM traversal to locate a reference to the element.

Some libraries like Prototype and jQuery can help you do this easily. In Prototype, the $$() function can help you find element by via CSS attributes. in jQuery you'd do something as simple as:

[ March 17, 2008: Message edited by: Bear Bibeault ]
 
Mahendran Aiyappan
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Bibeault,

I got it.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic