Reputation: 46
I am trying to use simple_html_dom to open a file and replace TR attributes.
The file contains a table with several rows with no css class or id assigned:
<tr OnMouseOver="changeCouleur(this);" onMouseOut="remetCouleur(this);" OnClick="show('13510.php');">
I use this code to get only the table from the loaded page:
$html = file_get_html('mandats/banque.html');
foreach ($html->find('table') as $node)
{ echo $node;}
So far the table shows properly, but i was not able to remove OnMouseOver and onMouseOut and to add a css class to modify the row.
I tried with :
$html->find('table,0')->class = 'mndlnk';
with no success
Basically i want to remove all current attributes, keep the link reference and insert a css class to each tr element.
Thanks in advance for your precious suggestions!
Upvotes: 1
Views: 2363
Reputation: 1169
In your question you have
$html->find('table,0')->class = 'mndlnk';
assuming that code was pasted here correctly it looks like you accidently put the ',0' inside of the quotes it should be
$html->find('table',0)->class = 'mndlnk';
if that still doesn't work, you might also want to try
$html->find('table', 0)->setAttribute('class', 'mndlnk');
Upvotes: 1