I have some javascript where I append an option to a select:
var myuniqueddl = $('#myuniqueddl');
$("<option value='0'>--- Select a value ---</option>").appendTo(myuniqueddl);
I'm actually trying to do this for another select as well.
I'm wondering to avoid code duplication should I be passing the ddl to a method to do this?
function(someType ddl)
{
$("<option value='0'>--- Select a value ---</option>").appendTo(ddl);
}
Is this a bad idea to be passing a select to a method?
Any better way of doing this?
If this way is ok what type do I pass it in as?