You can use
function parentWidth(elem) {
return elem.parentElement.clientWidth;
}
parentWidth(document.getElementById('typehead'));
Note that it will throw if you call it with the argument document.documentElement. If you want it to return undefined instead of throwing, use parentNode instead of parentElement.
function parentWidth(elem) {
return elem.parentElement.clientWidth;
}
alert(parentWidth(document.getElementById('typehead')) + 'px');
<div class="bs-example">
<input type="text" id="typehead" style="width: 500px;" class="form-control" placeholder="accounts" />
<br />
<input type="text" class="form-control" placeholder="accounts" />
</div>