Reputation: 2096
I have a input. I want my div when I append it, it has same width of input. Here my code.
$("#search-result").width($("#searchForm").width());
But $("#search-result")'width not equals $("#searchForm")'s width. I try to debug it in Chrome inspect element.
But it's gerenate to HTML like this:
Why? Is there any solution to make same width? Thanks
Upvotes: 0
Views: 228
Reputation: 462
var searchWidth = $("#searchForm").width() + 'px';
$("#search-result").css('width', searchWidth );
Upvotes: 1