note 126657 added to domelement.setattribute

From: Date: Thu, 02 Dec 2021 18:17:16 +0000
Subject: note 126657 added to domelement.setattribute
Groups: php.notes 
Request: Send a blank email to php-notes+get-217323@lists.php.net to get a copy of this message
Solution to render HTML 5 tags with attributes with/without value: <?php $dom = new DOMImplementation(); $doc = $dom->createDocument(null, 'html', $dom->createDocumentType('html')); $tag = $doc->appendChild($doc->createElement('input')); $tag->setAttribute('type', 'text'); $tag->setAttribute('disabled', ''); echo $doc->saveHTML($tag); // <input type="text" disabled=""> $doc->normalize(); // normalize attributes echo $doc->saveHTML($tag); // <input type="text" disabled> ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.112.85.242 (proxied: 31.129.215.166) ---- Manual Page -- https://php.net/manual/en/domelement.setattribute.php Edit -- https://main.php.net/note/edit/126657 Del: integrated -- https://main.php.net/note/delete/126657/integrated Del: useless -- https://main.php.net/note/delete/126657/useless Del: bad code -- https://main.php.net/note/delete/126657/bad+code Del: spam -- https://main.php.net/note/delete/126657/spam Del: non-english -- https://main.php.net/note/delete/126657/non-english Del: in docs -- https://main.php.net/note/delete/126657/in+docs Del: other reasons-- https://main.php.net/note/delete/126657 Reject -- https://main.php.net/note/reject/126657 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#217323) next »