sorry for my bad english
my code work with jquery 1.4.2 but not work with 1.7.1
I am receiving “missing ) after argument list” error in firebug with the code below:
$(document).ready(function() {
$('#content').html($('#content').html().replace(/#([a-zA-Z1-9]{1,})/gi,'<a href="<?php echo $this->webroot ?>instagrams/index/$1" class="tag_replace">#$1</a>'));
});
my generated code:
$(document).ready(function() {
$('#content').html($('#content').html().replace(/#([a-zA-Z1-9]{1,})/gi,'<a href="/instagram/instagrams/index/$1" class="tag_replace">#$1</a>'));
});
browser error code :
SyntaxError: missing ) after argument list
[Break On This Error]
…agram/instagrams/index/content” class=”tag_replace”>#content”).append(html)
jquery….min.js (line 11, col 63)
If you must write JS code dynamically using PHP, put the relevant variable on a line of its own so you can separate out problems with that from problems with your JS code.
You can also take advantage of the function parameter version of
.html():