Jquery code breaks page Javascript
- by Graham
I required a function to remove URLs from <a> divs found within <div class="rj_insertcode">. Not being familiar with with direction to tackle this, I eventually mustered up the following Jquery code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('div.rj_insertcode a').each(function() {
$(this).replaceWith($(this).html());
});
});
</script>
</head>
My site uses Joomla CMS and I was able to add the above script to the bottom of the template index.php. It works quite well and removes the links generated between the defined tags.
My problem:
Pages that also include JavaScript do not operate correctly. JavaScript appears to be disabled or not functioning.
What can I change to ensure JavaScript still operates correctly, or is there another method I could adopt?