javascript - Set width of one div to the width of another div -


i have search button on top left making search bar toggle. want achieve here this.

i want search bar same width "welcome" header right above it. welcome not inside header tag inside list tag.

here fiddle have created.

this tried.

 $(document).ready( function () { var x = $("#page2content :ul").width(); $("#example_filter").css('width', 'x'); }); 

i want width of welcome header width , store in var , pass var in css width of search bar. can please advice did wrong? please can u give me smilar solution dont want change width of search bar css directly want set css via jquery. thanks.

1- selector incorrect #page2content :ul, remove :, #page2content ul

2- returned x number, need add px make valid css property. , need target input

var x = $("#page2content ul").width(); $("#example_filter label input").css('width', x + 'px'); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -