Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Safari - Error: Syntax error, unrecognized expression: input[data-card-type="payment-one

on mac Safari (and older versions of FF v.38 and older) we are receiving the following error:

Error: Syntax error, unrecognized expression: input[data-card-type="payment-one"

jQuery Version: https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js

$(this).change(function() {
  if($(this).val() != '' ) {
    $('input[data-card-type="'+paymentGroup+'"').val('').prop('disabled',true);

In Safari's Console, in red it reads: Error: Syntax error, unrecognized expression: input[data-card-type="payment-one and beneath the error it reads: (anonymous function)

Does any of this look like it conflicts with jQuery 2.1.4, or maybe there is something else incorrect?

like image 761
caroline Avatar asked Aug 21 '15 18:08

caroline


1 Answers

This looks like it's a Safari issue, but really it never should have worked. You need to close the [data-card-type=paymentGroup statement, without that ending ] Safari will throw a fit. I know this from experience. Chrome (my main dev browser) will let this fly without a single peep, but Safari breaks (and rightfully so, its not valid).

Replace your code with this:

$(this).change(function() {
   if($(this).val() != '' ) {
     $('input[data-card-type="'+paymentGroup+'"]').val('').prop('disabled',true);
like image 67
ericjbasti Avatar answered Oct 26 '22 23:10

ericjbasti