Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

Commonmark migration
Source Link
  • onchange="check_extension(one)"

    onchange="check_extension(one)"

    Here one is the Node with the id "one", one is not the string "one"

Here one is the Node with the id "one", one is not the string "one"

  • document.getElementById("$field_id");

    document.getElementById("$field_id");

    Even if $field_id is the id "one", "$field_id" is a different string
    So getElementById("$field_id") will give you the node with id "$field_id", not the node with id "one".

Even if $field_id is the id "one", "$field_id" is a different string
So getElementById("$field_id") will give you the node with id "$field_id", not the node with id "one".

Fixes

onchange="check_extension('one')"

and

document.getElementById($field_id)

Also I discourage naming string variables with a leading $

  • onchange="check_extension(one)"

Here one is the Node with the id "one", one is not the string "one"

  • document.getElementById("$field_id");

Even if $field_id is the id "one", "$field_id" is a different string
So getElementById("$field_id") will give you the node with id "$field_id", not the node with id "one".

Fixes

onchange="check_extension('one')"

and

document.getElementById($field_id)

Also I discourage naming string variables with a leading $

  • onchange="check_extension(one)"

    Here one is the Node with the id "one", one is not the string "one"

  • document.getElementById("$field_id");

    Even if $field_id is the id "one", "$field_id" is a different string
    So getElementById("$field_id") will give you the node with id "$field_id", not the node with id "one".

Fixes

onchange="check_extension('one')"

and

document.getElementById($field_id)

Also I discourage naming string variables with a leading $

Source Link
Volune
  • 4.3k
  • 24
  • 23
  • onchange="check_extension(one)"

Here one is the Node with the id "one", one is not the string "one"

  • document.getElementById("$field_id");

Even if $field_id is the id "one", "$field_id" is a different string
So getElementById("$field_id") will give you the node with id "$field_id", not the node with id "one".

Fixes

onchange="check_extension('one')"

and

document.getElementById($field_id)

Also I discourage naming string variables with a leading $

lang-js

AltStyle によって変換されたページ (->オリジナル) /