jQuery addClass example

Change class name on click in jQuery

HTML

<html>
<body>
    <style>
        #target:focus {
            border: 1px solid darkblue;
        }
    </style>
    <div>
        <table>
            <tbody>
                <tr>
                    <td>
                        <select id="target" autofocus>
                            <option>Hi</option>
                            <option>Tea</option>
                            <option>Coffee</option>
                            <option>Bye</option>
                        </select>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</body>
</html>

<script type="text/javascript">
    $(document).ready(function () {
        $("#target").focus();
    });
</script>