I worked in a project where we had to do the exact same thing. Even though our solution become a bit more complex then the following, the example describes more or less the approach we used!
We end up wrapping the input.hidden element with a className!
<form name="shabba-form">
<input type="text" name="fullname" value="Shabba Ranks">
<div class="hiddenField">
<input type="hidden" name="myHiddenInput" value="foo">
</div>
</form>
Now, you can select the wanted input element and then check the parent location in your document!
$(document).ready(function(){
var data = $('input[name="myHiddenInput"]').parent('.hiddenField ').offset();
console.log(data);
});
In case you prefer, you can see a live example here http://jsbin.com/pugux/1/
- Remember that the wrapper class can have any style, as long is not display:hidden, you can make it not visible using visibility: hidden, height: 0px, opacity: 0 and stuff like that.
Hope this helps!