806Replacing HTML elements with jQuery’s replaceWith

Let's say you are having some HTML elements that should only be enabled, if the browser sports certain features. By default, the element is disabled, like in the following example:

Open File...

Next, we check in Javascript is this certain feature is supported. If it is, we replace the disabled element with an active version.

if (isSupported()) {
    $('#item').replaceWith('Open File...');
}

Which results in this:

Open File...

Simple, but effective.