Setup
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script> /* Import jQuery */ <script type="text/javascript" src="center.js"></script> /* Import Plugin */ <script type="text/javascript"> jQuery(document).ready(function($) { $("#center").center(); /* $("center") ID centering element. */ }); </script> /* Init Plugin */
Bug
- If the element has focus is the text then it must define its size in PX.