-2

Possible Duplicate:
Change tag attribute value with PHP DOMDocument

How can i use PHP DOMElement class to replace the href-value of a HTML-string with a new value?

With jQuery i would have done something like this

$('a[myattr~="myval"]').attr('href','http://www.google.se');

Thought that was the simplest way to explain it.

Community
  • 1
  • 1
Anton Gildebrand
  • 3,641
  • 12
  • 50
  • 86

1 Answers1

1

PHP is different from jQuery in a lot of very significant ways, but to answer your question:

$domelement->setAttribute("href", "http://www.google.se");

You might want to consult the documentation.

Asad Saeeduddin
  • 46,193
  • 6
  • 90
  • 139