Jquery code breaks page Javascript

Posted by Graham on Stack Overflow See other posts from Stack Overflow or by Graham
Published on 2010-12-30T03:25:26Z Indexed on 2010/12/30 3:54 UTC
Read the original article Hit count: 202

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery