Best way to concatenate two URL parameters into one hidden field
How can I concatenate two URL parameters into one hidden field? For example:
sometestingurl.com?color=yellow&thingy=box
We'd like "yellow-box" to pass in the hidden field, "finalProd".
- $('a[href^="http"]').each(function() {
- var $a = $(this),
- q = $a.attr('href') ? $a.attr('href').indexOf('?') : -1,
- contents = $a.html();
- if (q == -1) {
- $a.attr('href', $a.attr('href') + '?color=' + App.getParameterByName('color') + '&thingy=' + App.getParameterByName('thingy'));
- } else {
- $a.attr('href', $a.attr('href') + '&color=' + App.getParameterByName('color') + '&thingy=' + App.getParameterByName('thingy'));
- }
- $a.html(contents);
- });
- var color = $("#color").attr('value', App.getParameterByName('color'));
- var thingy = $("#thingy").attr('value', App.getParameterByName('thingy'));
- $("#finalProd") = color + '-' + thingy;
Within the form...
- <input type="hidden" name="finalProd" id='finalProd' value="">