I have set of following links in so many pages.
Following are the php file which have code .i.e.:
Input :
<a href="someurl/someotherfile.html"> Some Other file </a>
<a href="someurl/someotherfile1.html"> Some Other file1 </a>
<p><a href="someurl/someotherfile2.html"> Some Other file2 </a></p>
<div><a href="someurl/someotherfile2.html"> Some Other file2 </a></div>
<span><a href="someurl/someotherfile2.html"> Some Other file2 </a></span>
Output :
<a href="someurl/someotherfile.php"> Some Other file </a>
<a href="someurl/someotherfile1.php"> Some Other file1 </a>
<p><a href="someurl/someotherfile2.php"> Some Other file2 </a></p>
<div><a href="someurl/someotherfile2.php"> Some Other file2 </a></div>
<span><a href="someurl/someotherfile2.php"> Some Other file2 </a></span>
Now, I want to change the html to php extension in href attribute. without modifying the php code.
I have try following code but it does not work. Noting to happen in this code.
$('a').each(function() {
$(this).html( $(this).html().replace( ".php", '.html' ) );
});
Aucun commentaire:
Enregistrer un commentaire