Search code examples
jquerywidthpercentage

div width with jquery in percent


I try to adapt this code jquery so that the width of my div "book" is in percentage.

<div id="book" class='album'>
d.wowBook.defaults={width:1200,......YES
d.wowBook.defaults={"width:100%",......NO
d.wowBook.defaults={'width:100%',......NO
d.wowBook.defaults={width:"100%",......NO
d.wowBook.defaults={width:100+"%",......NO  

thanks in advance

Solution

  • You can provide width in percentage by using jquery

    $(document).ready(function(){
     $("#book").width('40%');
    //or
     $("#book").css('width','40%');
    });