jQuery set value depending on tagName
<h1>Original Question</h1>

<p>Is there a jQuery method that will check the selection type and set the value appropriately? Example, using .html() or .val().</p>

<p>I have made my own method to do the work for me however am not sure if this is the best way to preform this task.</p>

<pre><code>$.fn.data = function(value) {
    if(this.is("input")){
        this.val(value);
    }else if(... other type ...){
        this.val(value);
    }else{
        this.html(value);
    }
};
</code></pre>

<p>I have also looked at using the tagName attribute. 
    var type = this.prop("tagName").toLowerCase();</p>

<p><strong>Edit:</strong></p>

<h1>Benchmarking</h1>

<p>For anyone interested I did a little benchmarking between this.tagName; and $(this).is("input"); with 10,000 records. </p>

<p><code>this.tagName.toLowerCase();</code> x 10,000 records = 185 milliseconds</p>

<p><code>$(this).is("input");</code> x 10,000 records = 1676  milliseconds</p>
