Jump to content

there is an error with this onclick functon


picwizz

Recommended Posts

hi, im having trouble with the following code

 

this is just one line from the code which is not working

 

$('.likehide'+pid).html('<a href="#" onclick="unlike(pid); return false;">unlike</a>');

 

The code works but when i inspect the element, it shows up like this

 

<a href="#" onclick="unlike(pid); return false;">unlike</a>

 

it should not have "pid" it should be displaying the pid value

 

What am i doing wrong in the jquery code? Thanks

 

i have done that here is the full function

 

 

function like(pid){
$.post('inc/like.php', {pid:pid}, function(data){
if(data == "yes"){
countlike(pid);
$('.likehide'+pid).html('<a href="#" onclick="unlike(pid); return false;">unlike</a>');
} else {
alert("error:"+ data);
}
});
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.