【发布时间】:2015-02-06 16:17:32
【问题描述】:
我需要将 jquery-cookie 用于函数 showHide(shID) 有人知道该怎么做吗?我有一个 onclick 按钮来显示更多内容,使用函数 showHide(shID) 但我只需要隐藏一次。那么可以为它添加 jquery-cookie 吗?我该怎么做? [https://github.com/carhartl/jquery-cookie#readme][1]
这里是我的代码:function showHide(shID)
<script language="javascript" type="text/javascript">
function showHide(shID) {
if (document.getElementById(shID)) {
if (document.getElementById(shID+'-show').style.display != 'none') {
document.getElementById(shID+'-show').style.display = 'none';
document.getElementById(shID).style.display = 'block';
}
else {
document.getElementById(shID+'-show').style.display = 'inline';
document.getElementById(shID).style.display = 'none';
}
}
}
</script>
拜托,我需要有人指导我或让我知道该怎么做。提前致谢!
【问题讨论】:
标签: javascript jquery cookies show-hide jquery-cookie