Skip to main content
CodeDeveloperOM
Inspiring
May 14, 2021
Answered

Document.getElementById() ??

  • May 14, 2021
  • 1 reply
  • 651 views

HTML5 canvas

I have a movie clip

 

var img = container.document.getElementById("img").getElementsByClassName("text_input_css");
container.style.width = newWidth;
container.style.height = newHeight;

 

 

 

    This topic has been closed for replies.
    Correct answer kglad

    use

     

    document.getElementById("img");

     

    if you have an element with id = img

     

    the css is irrelevant.

     

    and use

     

    document.getElementsByClassName("text_input_css);

     

    if you have elements from that class in your html

    1 reply

    kglad
    Community Expert
    kgladCommunity ExpertCorrect answer
    Community Expert
    May 15, 2021

    use

     

    document.getElementById("img");

     

    if you have an element with id = img

     

    the css is irrelevant.

     

    and use

     

    document.getElementsByClassName("text_input_css);

     

    if you have elements from that class in your html