Uncaught Error: Syntax error, unrecognized expression: #

  • Dario Bi
  • Topic Author
  • Offline
  • New Member
  • New Member
More
5 years 5 months ago - 5 years 5 months ago #138394 by Dario Bi
Hi, making a custom field dependencies i get a javascript error "Uncaught Error: Syntax error, unrecognized expression: #" (on line 446 of paymentmethods.js).
I made a radio button custom field, then two text custom field dependent on radio button.
When I choose radio button, fields disappears and this is ok. But when I try to show fields pressing radio button i got that error.
Examining the code on media/com_osmembership/assets/js/paymentmethods.js i saw that in the line 456 there's a for loop where the last value is empty. When the line
Code:
$('#' + hideFields[i]).hide();
tries to hide the element hideFields, it's empty and i get that error. Modifying the code with
Code:
if(hideFields[i] != '')
the problem does not appear anymore. i don't know if i clearly explained the problem, i'm sorry.
the code starting from line 456 was:
Code:
for (i = 0; i < hideFields.length; i++) { $('#' + hideFields[i]).hide(); } for (i = 0; i < showFields.length; i++) { $('#' + showFields[i]).show(); }
i changed that in:
Code:
for (i = 0; i < hideFields.length; i++) { if(hideFields[i] != '') $('#' + hideFields[i]).hide(); } for (i = 0; i < showFields.length; i++) { if(showFields[i] != '') $('#' + showFields[i]).show(); }
Maybe I made some mistake?
Last edit: 5 years 5 months ago by Dario Bi.

Please Log in or Create an account to join the conversation.

More
5 years 5 months ago #138402 by Tuan Pham Ngoc
Hello

Yes, maybe so. For this, please help submitting a support ticket sending us:

- Super admin account of the site
- Link to the page which we can see this error
- Tell me ID of the radio custom field you are talking about

I will check to see what's wrong and get it sorted

Regards,

Tuan

Please Log in or Create an account to join the conversation.