使用jquery更改标签标签的可见性 [英] change visibility of label tag using jquery

查看:487
本文介绍了使用jquery更改标签标签的可见性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在网页加载时隐藏可见的标签。如何使用jquery使其可见?

I have a label with hidden visibility on page load. How can i make it visible using jquery

<label for="error" style="margin:100px auto 60px auto;color:Red; line-height:40px;font-size:medium;visibility:hidden">error occured</label>

我可以隐藏它。

  $('label[for="error"]').hide();

这不起作用

 $('label[for="error"]').show(); 


推荐答案

更改您的代码如下:

<label for="error" style="margin:100px auto 60px auto;color:Red; line-height:40px;font-size:medium;display:none">error occured</label>

我替换了你的visibility:hidden with display:none。

I've replaced your visibility:hidden with display:none.

然后可以使用jQuery hide()和show()函数。

You can then use the jQuery hide() and show() functions.

这篇关于使用jquery更改标签标签的可见性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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