noscript element

If you don't know what an element is or how you must use it, I recommend you read the "HTML tags and attributes" tutorial that you can find in the HTML tutorials section.

Description

The noscript element is a container for alternate content to a script that's displayed when script support is absent or disabled. The behavior and representation of this element varies depending on wether scripting is enabled or not. If scripting is disabled, this element represents its contents, otherwise, it represents nothing and browsers ignore it completely.

In general, a noscript element may be placed right after the script it's intended to replace when scripting support is disabled. Nevertheless, authors' creativity may play an important role in the placement of this element, as long as they take into account the fact that this element will be shown when the scripts in the page aren't being executed.

When declared in the head block, the noscript element must not contain any element other than link, style and meta.

Examples

In the following example, we're creating a form to make a simple mathematical operation. The script will be in charge of calculating the product between the two numbers and the noscript will display a button to submit the values to the server and continue the process there. This way, the alternate version provided by the noscript element will allow users to enjoy the page even when support for scripting is absent or disabled.

The functions provided in this example are outside the scope of this website and won't be explained in this document.

<form action="calculate-product.php" target="_blank">
  <p>
    Calculate the product:
    <input type="number" id="number1" name="number1" onchange="calculateProduct()"> x
    <input type="number" id="number2" name="number2" onchange="calculateProduct()">
    <output id="result"></output>
    <script>
      function calculateProduct() {
        var number1 = parseFloat(document.getElementById('number1').value),
            number2 = parseFloat(document.getElementById('number2').value),
            outputElement = document.getElementById('result');
        if(isNaN(number1) || isNaN(number1)) {
          outputElement.value = 'Input error!';
        } else {
          outputElement.value = number1 * number2;
        }
      }
    </script>
    <noscript>
      <input type="submit" value="Calculate">
    </noscript>
  </p>
</form>

Calculate the product: x

Attributes

Global attributes

For information about global attributes refer to this list of global attributes in HTML5.

Events

Global events

For information about global events refer to this list of global events in HTML5.