That code should not work on _any_ browser. In the onclick attribute
you are grqbbing a reference to the containing div ($
('#followButton2')), which clearly has no method named followUser. Try
something like this instead:
<script>
$(document).ready(function(){
$('div a').click(function(){
followUser($(this).attr('rel');
});
});
<div id="followButton2">
<a rel="2">test1</a>
</div>
Sent from my iPhone
On Sep 26, 2009, at 6:26, indre1 <ind...@gmail.com> wrote:
Any suggestions, why this code is not working on Webkit browsers:
(function($) {
$.fn.followUser = function(userId) {
this.fadeOut(250);
$.get("profile.php", { do: "addfriend", id: userId }, function
(data)
{
return this.html('<p>Follower added</p>').fadeIn(250);
});
}
})(jQuery);
Only jquery and the plugin printed above are loaded, so there
shouldn't be any conflicts.
HTML:
<div id="followButton2">
<a onclick="$('#followButton2').followUser('2')">test1</a>
</div>
Chrome gives the following error:
Uncaught TypeError: Object #<an Object> has no method 'followUser