This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get element's Id or name for dynamically created element(textbox)

 
zimbu bolleddu
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have created some textboxes dynamically by using

var sun = document.createElement('input');

with button click.

after some time I will re visit the fields, how do I retrive that element's Id or name onblur event.

Bythe following code I used to get the value of the specified element, but I want id or name of that element .

code examples are highly appreciated.

Thanks & regards,
zimbu
 
Praful Thakare
Ranch Hand
Posts: 642
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you cannot retrieve id and name if its not assigned. try following code



[ August 29, 2008: Message edited by: Praful Thakare ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64188
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I really don't know what you are asking. Did you give the element an id when you created it? If not, it doesn't have one. If you did, then what's your question? If you have a reference to the element, you can retrieve its id (if it has one). If you have the id, you can get a reference to the element. If you don't have either of these, you need some other way to uniquely identify the element in order to find it.
[ August 29, 2008: Message edited by: Bear Bibeault ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic