So I have someone else’s old code that I am trying to restore. I am not too familiar with jQuery, but what does the @ operator specify?
The code is:
v_button_format = $('#' + v_form_id).find('input[@name=button_format]').val();
v_content_type = $('#' + v_form_id).find('input[@name=content_type]').val();
I am using jQuery 1.3 and it’s throwing an “uncaught exception: Syntax error, unrecognized expression: [@name=button_format]” error. Is there a compatibility issue?
This is an attribute selector.
The
@is an XPath-ism that is no longer used in jQuery.In addition, newer versions of jQuery require the attribute value to be in quotes.
Therefore, you should write