<tr class="list1Row#currRow mod 2#" id="job_list_#jc_id#_pjcid#jc_parent#">
<td nowrap="nowrap" style="border-top:1px solid black; text-align:left; min-width:40px;">
<cfset qTwokiloFavorite = application.JobControlDAO.FavoriteRead(jcid=twokilo_id,uid=#userid#)>
<span id="job_fav_#jc_id#">
<cfif qJcFavorite.recordcount GT 0>
<img src="_images/star_filled.png" height="18px" width="18px" alt="Remove Favorite" style="cursor:pointer;" align="absmiddle" onclick="jc_deleteFavorite(#jc_id#);"/>
<cfelse>
<img src="_images/star_empty.png" height="18px" width="18px" alt="Make Favorite" style="cursor:pointer;" align="absmiddle" onclick="jc_saveFavorite(#jc_id#);"/>
</cfif>
</span>
</td>
....other tds
</tr>
function tk_deleteFavorite(jcid)
{
var sJcFav = "job_fav_" + jcid;
var sEmptyStar = '<img src="_images/star_filled.png" height="18px" width="18px" alt="Remove Favorite" style="cursor:pointer;" align="absmiddle" onclick="jc_deleteFavorite(';
sEmptyStar += jcid;
sEmptyStar += ');"/>';
showStatus('Removing Favorite ...');
$j('#' + sJcFav + ' span').html(sEmptyStar);
ajax call here to delete favorite association -- works
}
When the page loads, the favorite star is determined by a queried value so that is why I have an if statement in the span.
However, when a user clicks on the star_filled
image, I need to replace that image with the star_empty image. I have tried to empty the span and replace that way, but cannot get it to replace.
I left off the ajax call which removes the association of the favorite because that part is working.