Win a copy of Building Blockchain Apps this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Liutauras Vilda
  • Knute Snortum
  • Bear Bibeault
Sheriffs:
  • Devaka Cooray
  • Jeanne Boyarsky
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • salvin francis
Bartenders:
  • Tim Holloway
  • Piet Souris
  • Frits Walraven

HTML Label field's "for" attribute problem

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • 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 ]
 
Marshal
Posts: 67366
173
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Bibeault,

I got it.
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!