I want to remove the onclick event from my html tag. For instance, given the following:
<input type=“text” name=“txtEmail” id=“txtEmail” onclick=“parent.showTestStrategyDiv(this.id, this.name);” />
‘onclick’ will be removed and the new string will look like this:
<input type=“text” name=“txtEmail” id=“txtEmail” />
To do this, I call the preg_replace method in php:
$alteredContent3 = preg_replace("#(<input.+?)(on[Cc]lick.+?)(/?>)#i", “\1\3”, $alterContent2);
Given that alterContent2 is the the html page which I want to alter. Somehow, when I tried to print out the values for $alteredContent3, nothing is returned. Any help is greatly appreciated. Thanks in advance.