I am trying to allign a table with an input so that the table creates a google-like drop-down. I am using jquery to retrieve the position and dimensions of the input element and then css to position the table. Things work pretty smooth when I don't use DOCTYPE.
Now, when ANY DOCTYPE is included on the page things go wrong (weirdly not in IE). Table is suddenly 1px wider and moves up and left by 1px.
Please someone help! Perhaps some of you have a piece of code that doesn the correct allignment.
<!--<!DOCTYPE html>-->
<html>
<script src="js/jquery/jquery.js"></script>
<body>
<input type="text" id="input" />
<table id="dropdown" style="border: solid 1px black; border-collapse: collapse; position: absolute;">
<tr>
<td>Text</td>
</tr>
</table>
<script>
var input = $("#input");
var dropdown = $("#dropdown");
dropdown.css("top", input.position().top + input.outerHeight() - 1);
dropdown.css("left", input.position());
dropdown.css("width", input.outerWidth());
</script>
</body>
</html>