How to set a default value with $(selector).val()

How to set a default value with $(selector).val()

Hey,

is there any way to set the default value returned by $(selector).val()  while the object (text, textarea...) has no value? What I mean is the way something like below:

  1. $(selector).val().setDefault('myDefaultValue');

Right now the only way is doing some little overcode like:

  1. var value = '';
    value = $(selector).val();
    if (!value) {
          value = 'myDefaultValue'
    }

Cheers
Andrzej