开发者

How to make a div hidden by default made by a content_tag_for

开发者_JAVA技巧I have made a div through content_tag_for and I wish to make it hidden by default. How do I do that? I am using jquery as well.


Attach a class:

content_tag_for(:div, @person, :class => "hidden") { # blah blah }

And define it as hidden in the stylesheet:

div.hidden { display: none }

Note: you can also use div_for, which saves some code. See the API.


Wont this work since you mention you are using JQuery?

In HEAD of Page:

<script>
$(document).ready(function() {
  $('#your-div-id').hide();
});
</script>

Or in BODY of Page AFTER the div you are creating, just:

<script>
  $('#your-div-id').hide();
</script>

Or am I misunderstanding your question? Thanks.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜