My asp.net mvc4 project utilizes bootstrap for markup and jquery for client side functionality.
<div class="row">
<div class="col-md-4 container" id="cont">
<div class="row overlay_container" id="overlayCont">
<div class="col-md-12 background" id="bg"></div>
<div class="col-md-12 text" id="txt">
<h1>This is a test!</h1>
This is also a test!
</div>
</div>
<div class="row">
<div class="col-md-12">
<img src="~/Content/Images/5.jpg" id="porfolioImage" />
</div>
</div>
</div>
var wdth = $("#porfolioImage").width();
alert(wdth);
var hgth = $("#porfolioImage").height();
alert(hgth);
$("#overlayCont").width(wdth).height(hgth);
$("#bg").width(wdth).height(hgth);
After triggering the alert, the values returned are wdth = 382 and hgth = 382. However, upon replacing elements, the following line is produced:
[<div class="col-md-12 background" id="bg" style="width: 412px; height: 382px;"></div>]
I am unsure as to why it inserts 412 instead of the expected 382. How can I rectify this issue?