Is there any better way to do this in jquery?
<p>I want to know that is there any better method to do :</p>

<pre><code>var name = $('input').attr("name") != "undefined" ? $('input').attr("name") : "";
</code></pre>

<p>Here i am reading the <code>name</code> attribute of <code>input</code>. My problem is when i read the <code>name</code> for newly created <code>text</code> element, then it was <code>undefined</code>. So for not showing <code>undefined</code> to the user i have to put this check.Now i have to ready so many properties and in all of then the same problem exist so that`s why i want to know that, Is there any better way to deal will this?</p>
