I Have this script below that suppose to get values from input fields and then add them in a href link. but i keep getting this error in console:
Uncaught Error: Syntax error, unrecognized expression: ?add-to-cart=7690&variation_id=8498&attribute_pa_color=gold
Here is the script:
jQuery(document).on("click", ".variations_form.cart .variation_buttons_wrapper a", function(){
// Get all the values needed for the URL
var add_to_cart = jQuery(this).parent().parent().parent().parent().parent().parent().find( 'input[name="add-to-cart"]' ).val();
var variation_id = jQuery(this).parent().parent().parent().parent().parent().parent().find( 'input[name="variation_id"]' ).val();
var pa_color = jQuery(this).attr("id");
setTimeout(function(){
// Craft the URL
var link = jQuery("?add-to-cart=" + add_to_cart + "&variation_id=" + variation_id + "&attribute_pa_color=" + pa_color);
alert(link);
}, 500);
});
Any ideas??