jQuery: Optimize code (learning case)
<p>I have to admit, I came up with this solution by pure intuition from seeing many jQuery scripts during all the time I've been experimenting and learning on my own.</p>

<p>Since I don't have anyone to ask in person these kind of questions, that's why I come here for help and guidance.</p>

<p>--</p>

<p>Inspired by <a href="https://secure.wufoo.com/signup/1/" rel="nofollow">Wufoo's plans' forms</a> where the row you need to focus is highlighted while filling out the form, I created this script (I am not a jQuery or JavaScript guru, I'm still learning and practicing):</p>

<pre><code>//Improve usability by highlighting the row the user needs to focus on:
$(function() {
        //When input element has focus
        $('input').focus(function(){
            //Add the class to its corresponding row
            $(this).parent().parent('.row').addClass('focus'),
                //And when it loses focus
                $('input').blur(function(){
                    //Remove the class
                    $(this).parent().parent('.row').removeClass('focus');
                });
        });
});
</code></pre>

<p>So I was wondering if this script has a way of being written better or optimized/shorten in any way. If not, and the way I wrote it's Ok, that's fine, all I'd like to learn is ways of optimizing code when possible, that's all.</p>

<p>I created a <strong><a href="http://codepen.io/rzea/pen/mBbjs" rel="nofollow">Demo in Codepen</a></strong> if you want to check it out.</p>

<p>Thanks in advance.</p>
