I created a button in the order details in the customer area that sends me to a form, I want to fill in the input of this form with the order number and a text.
I managed to ensure that when clicking on the button, the customer is directed to the form and the input is already filled in with the order number, but in this same input I would like to insert text before the number.
Ex: Order #99999
All that remains is to enter the text: Order#
Code: Select all
<input type="text" name="subject" value="{{ subject }}" placeholder="{{ entry_subject }}" id="input-subject" class="form-control" />
Code: Select all
$.urlParam = function (name) {
var results = new RegExp('[\?&]' + name + '=([^&#]*)')
.exec(window.location.search);
return results[1] || 0;
}
$("#input-subject").val($.urlParam('order_id'));