javascriptadobe-brackets

Facing a problem in JavaScript on Brackets


When I write: document.getElementById("demo").innerHTML on Brackets editor I face a problem, it says: ERROR: 'document' is not defined. [no-undef]. Thank you...


Solution

  • If so you can change your eslint config by using environment "browser" to ignore those error.

    The Document method getElementById() returns an Element object representing the element whose id property matches the specified string. Since element IDs are required to be unique if specified, they're a useful way to get access to a specific element quickly.

    If you need to get access to an element:

    let element = document.getElementById("demo")
    
    element.innerHTML = "Paragraph changed!";