var querystr=window.location.search; if ((querystr.length > 0) && (jQuery('input[name="source_code"]').length > 0)) { jQuery('input[name="source_code"]').val(querystr); }