I want to change the Css to opacity 1 when item is clicked.
Following is the code (html)
<a href="#"><img class="<?php if($favorite == 1){ echo 'alreadyfavorite';} else { echo 'addtofavorite';} ?>" id="<?php
while($data5=$select5->fetch()){
echo $data5['favorite_properties_id'];
}
?>" src="../images/system/addtofavorite.png"></a>
Jquery
$('.alreadyfavorite').click(function()
{
event.preventDefault();
var del_id = $(this).attr('id');
$.ajax(
{
type: 'POST',
url: '../controllers/deletefavoriteproperties.php',
data:
{
del_id: del_id
},
success: function(data)
{
$('.alreadyfavorite').css("addtofavorite");
}
});
});
neither this
$('.alreadyfavorite').css("addtofavorite");
nor this
$('.alreadyfavorite').css("opacity:1;");
is working....
$('.alreadyfavorite').css("opacity",1);