I am using a plugin with WordPress for contact forms, and have a file upload. I can’t assign an “ID” or class to the field, it only has a name. How can I select this field to get the value and display it in a text field? I was using this code, which worked perfectly when the upload field had an ID.. So I need to figure out how to modify it to work with just a field name.. The name is “CustomFormsFileUpload_945”
$(function() {
$("#ufo-field-id-945").change(function() {
$("#ufo-field-id-948").val($(this).val())
var string = $("#ufo-field-id-948").val();
var new_string = string.replace('C:\\fakepath\\', '');
$("#ufo-field-id-948").val(new_string);
});
});
You can use an attribute selector:
(And if you don’t actually have both
945and948there, you should keep it in a variable.)