I have a button displayed below. When I click it should hide and another background image should come.
我有一个按钮显示在下面。当我点击它应该隐藏和另一个背景图像应该来。
I am adding this from backed displayed below
我将从下面显示的支持中添加此内容
htmlDataId += "<a onclick=\"getChilds('"+row[primaryField]+"','false','UniqueId')\" title='View' ><i class='plus-symbol' style='height:2px;' id="+row['Id']+"> </i></a>     ${row[selectedLabel]}"
On click only symbol should hide with jquery function and replace with other background image.
单击时,仅使用jquery函数隐藏符号并替换为其他背景图像。
This method will get execute onclick
此方法将执行onclick
function getChilds(primaryId, isFlat, col) {
alert(event.target.id);
//$("#'+ event.target.id +'").removeClass('plus-symbol')
alert(primaryId)
}
1 个解决方案
#1
0
I would suggest switching class when appropriate, instead of hiding/showing elements.
我建议在适当时切换类,而不是隐藏/显示元素。
You can use hideClass
and removeClass
from jQuery (which you tagged in the question), something like:
你可以使用jQuery中的hideClass和removeClass(你在问题中标记了),例如:
htmlDataId += "<a onclick=\"$(this).find('i').removeClass('plus-symbol').addClass('minus-symbol')\" title='View' ><i class='plus-symbol' style='height:2px;' id="+row['Id']+"> </i></a>"
#1
0
I would suggest switching class when appropriate, instead of hiding/showing elements.
我建议在适当时切换类,而不是隐藏/显示元素。
You can use hideClass
and removeClass
from jQuery (which you tagged in the question), something like:
你可以使用jQuery中的hideClass和removeClass(你在问题中标记了),例如:
htmlDataId += "<a onclick=\"$(this).find('i').removeClass('plus-symbol').addClass('minus-symbol')\" title='View' ><i class='plus-symbol' style='height:2px;' id="+row['Id']+"> </i></a>"