Reputation: 1
I want to set the width of a div to the same value as the window height.
I tried something like this:
<script type="text/javascript">
$(".rt-container").style.width = $(window).height();
</script>
But it's not working. Maybe because I'm an absolute beginner with javascript.
How can I achieve it (by using jquery)?
Upvotes: 0
Views: 87
Reputation: 1201
You can change css
styles like this, use the method .css()
with option
and value
as parameters and add the "px" to value, as mentioned in comments:
<script type="text/javascript">
$(".rt-container").css("width",$(window).height() +"px");
</script>
Upvotes: 2