www.webdeveloper.com
Results 1 to 4 of 4

Thread: dynamic control with getElementById

  1. #1
    Join Date
    Feb 2007
    Posts
    7

    dynamic control with getElementById

    hi,

    I need to give a variable control with getElementById.
    something like document.getElementById("Control" + i).innerHTML
    it gives error.
    how can i do this?

    Pls help

    thanks

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    How are you using this statement?

  3. #3
    Join Date
    Feb 2007
    Posts
    7
    I have few controls created dynamically on form. I need to set their inner html with AJAX. so it should look like

    document.getElementById(elem).innerHTML = strValue;

    where elem will be the name of control taken as a variable.

    just need to know the current syntax how it will work.

    thanks

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    You are sill not showing how you are using this statement.
    You possibly require a closure to pass the variable: http://www.webdeveloper.com/forum/sh...8&postcount=11

Thread Information

Users Browsing this Thread

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

Posting Permissions

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



Recent Articles