我有这样的 html:ul 有几个 li 元素,带有删除按钮,
问题是:我需要用 CheckMark Image 符号显示正确的 li 元素,
假设我正在调用 ShowCheckMarkLi(Descriptions,Client)
那么只有 2 li 应该显示在带有 CheckmarkImage.Ico 的 UL 元素中,其他应该消失
html是这样的:-
<ul>
<li id="liRightDescriptions">
<span>
<span>Descriptions</span>
<img class="removeImg" src="../Images/RemoveButton.ico" /></span>
</li>
<li id="liRightSpecialization">
<span><span>Specialization</span><img style="display: none;" class="removeImg" src="../Images/RemoveButton.ico" /></span>
</li>
<li id="liRightOrgChart">
<span>Org Chart</span><img style="display: none;" class="removeImg" src="../Images/RemoveButton.ico" />
</li>
<li id="liRightClient"><span>
<span>Client</span>
<img style="display: none;" class="removeImg" src="../Images/RemoveButton.ico" /></span></li>
<li id="liRightAchievements"><span>
<span>Achievements</span>
<img class="removeImg" src="../Images/RemoveButton.ico" /></span></li>
<li id="liRightMemberships"><span>
<span>Memberships</span>
<img class="removeImg" src="../Images/RemoveButton.ico" /></span></li>
<li id="liRightGetRatings"><span>
<span>Get Ratings</span>
<img class="removeImg" src="../Images/RemoveButton.ico" /></span></li>
<li id="liRightSkills"><span>
<span>Skills</span>
<img class="removeImg" src="../Images/RemoveButton.ico" /></span></li>
</ul>
我正在尝试这样:
function ShowRightCheckMarkButton(Descriptions, Skills, Client, Achievements, Memberships, OrgChart, Specialization,GetRatings) {
$('.divright').css("visibility", "visible");
$('#listProjectRelated').empty();
if (Achievements) {
$('#listProjectRelated').append("<li id='liRightAchievements'><span><span>Achievements</span><img class='checkImg' src='../Images/Checkmark.ico'/></span></li>")
}
else
{
$('#listProjectRelated').append("<li id='liRightAchievements'><span><span>Achievements</span><img class='removeImg' src='../Images/RemoveButton.ico'/></span></li>")
}
.
.
.
.
.
.
}