Get the closest img title and set as field title
<p>I am going to explain my question by an example:</p>

<p>Here is my html code:</p>

<pre><code>&lt;td&gt;Name&lt;a href="http://manual"&gt;&lt;span&gt;&lt;img src="x" width="15" title="The name&gt;&lt;/span&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;input type="text" name="name" maxlength="80" size="93" &gt;&lt;/td&gt;
</code></pre>

<p>What I want to do is get the closest img title to my input field, and set it as the field title. The purpose is basically check all the page's form fields and set the closest image title to their title, if the title has not been set.</p>

<p>What I have done so far:</p>

<pre><code>$('form').find(':input').each(function(){
    if(!$(this).attr('title') &amp;&amp; $(this).attr('type') != "hidden" ){

        var title = $(this).siblings('td').find("img").attr("title");
        $(this).attr('title', title);

    }
});
</code></pre>

<p>But no success. I'd be grateful if someone can help me out with this. </p>

<p>Thanks, </p>
