Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php dom add class to element

$dom = new DOMDocument;
$dom->loadHTML($html);
$divs = $dom->getElementsByTagName('div');
foreach ($divs as $div) {
        $div->setAttribute('class', $div->getAttribute('class').' myclass');
}
$html = $dom->saveHTML();
Comment

PREVIOUS NEXT
Code Example
Php :: php curl post application/x-www-form-urlencoded 
Php :: ucwords in php 
Php :: max_input_time in wordpress 
Php :: php 3 months ago 
Php :: Call to undefined function AppHttpControllerscurl_init() 
Php :: confirm before submit form php 
Php :: php curl post json 
Php :: blade comment 
Php :: php array index exists 
Php :: Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. 
Php :: laravel make trait command 
Php :: php sec into date time 
Php :: laravel response redirect 
Php :: codeigniter 3 limit 
Php :: write if and else in one line php 
Php :: laravel doesNotHave in model 
Php :: php uppercase each word 
Php :: PHP Fatal error: Call to undefined function factory() in Psy Shell code on line 1, LARAVEL 8 Issue solved 
Php :: dequeue beaver buillder script wordpress 
Php :: php throw exception 
Php :: wordpress get username 
Php :: php date + 1 year 
Php :: wp php related post by category 
Php :: date_default_timezone_set for india in php 
Php :: php carbon get timestamp 
Php :: php clear output 
Php :: delete cache laravel 
Php :: magento 2 change customers password 
Php :: Connecting to the database using mysqli 
Php :: logout in laravel 8 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =