在javascript中将样式显示从无更改为阻止? [英] Changing the style display from none to block in javascript?

查看:90
本文介绍了在javascript中将样式显示从无更改为阻止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是html代码片段

 < li style =opacity:1;> 
< / li>

这是jquery函数,它在加载时被调用

  $(function(){
$ .ajax({
url:url,
dataType:'json',
data:'',
type:'POST',
success:function(data){
alert(Test);
document.getElementById(LinkDisplay) .style.diplay =block; // line 1
//在执行此行后,我应该看到链接,因为我有
//将链接显示从none更改为block,但它仍然不可见
});
});
}

第1行执行后,我不确定为什么我的链接是不会变得可见? 由于您使用的是jQuery,因此您可以写

  $(#elemId)。show()


Here is html code snippet

<li style="opacity: 1;">
    <a id="LinkDisplay" class="optionsDropDown" style="color:#FF0000;display:none" href="javascript:showThisLink('LinkId');">
</li>

Here is jquery function which is being called at on load

$(function () {
    $.ajax({
        url: url,
        dataType: 'json',
        data: '',
        type: 'POST',
        success: function (data) {
            alert("Test");
            document.getElementById("LinkDisplay").style.diplay="block"; // line 1
            // after this line execution i should see the link as i have
            // changed the link display from none to block but it is still invisible
        });
    });
}

After line 1 execution , I am not sure why my link is not becoming visible?

Since you are using jQuery you could just write

$("#elemId").show()

这篇关于在javascript中将样式显示从无更改为阻止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆