| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/en-US/docs/Web/API/ProcessingInstruction/hasAttribute | [Back] [Original] |
Get to know MDN better
The hasAttribute() method of the ProcessingInstruction interface returns a
boolean value indicating whether the specified element has the
specified attribute or not.
hasAttribute(name)
nameA string representing the name of the attribute.
A boolean.
const pi = document.createProcessingInstruction("start", 'name="placeholder"');
console.log(pi.hasAttribute("name"));
// logs:
// true
| Specification |
|---|
| DOM # dom-processinginstruction-hasattribute |
ProcessingInstruction.hasAttributes()ProcessingInstruction.getAttribute()ProcessingInstruction.getAttributeNames()ProcessingInstruction.setAttribute()ProcessingInstruction.removeAttribute()ProcessingInstruction.toggleAttribute()This page was last modified on Aug 13, 2026 by MDN contributors.
ProcessingInstructionAbortControllerAbortSignalAbstractRangeAttrCDATASectionCharacterDataCommentCustomEventDOMErrorDOMExceptionDOMImplementationDOMParserDOMTokenListDocumentDocumentFragmentDocumentTypeElementEventEventTargetHTMLCollectionMutationObserverMutationRecordNamedNodeMapNodeNodeIteratorNodeListQuotaExceededErrorRangeShadowRootStaticRangeTextTreeWalkerXMLDocumentXPathEvaluatorXPathExpressionXPathResultXSLTProcessorYour blueprint for a better internet.
Portions of this content are 19982026 by individual mozilla.org contributors. Content available under a Creative Commons license.
| Web Proxy Viewer | New URL | Original Page |