//" /> //" /> //"/>
Is it possible to use PHP querypath to get the HTML5 data attribute of a DOM element? E.g:
//HTML element <div data-foo-attribute="whatever"></div> //PHP $attribute = $mydiv->attr('data-foo-attribute'); //does not work
you can use attr('data-foo-attribute') for that
attr('data-foo-attribute')
$html = '<div data-foo-attribute="whatever"></div>'; $qp = htmlqp($html); $mydiv = $qp->find('div'); $attribute = $mydiv->attr('data-foo-attribute');
Or you can use data():
data()
$html = '<div data-foo-attribute="whatever"></div>'; $qp = htmlqp($html); $mydiv = $qp->find('div'); $attribute = $mydiv->data('foo-attribute');
Copyright © 2021 Jogjafile Inc.
Or you can use
data():