开发者_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.
精彩评论