I have a selection box with the same Id and Name like the one below:
<input id="primary_employee_address[country_code]" name ="primary_employee_address[country_code]"
Now if i do
document.getElementById( 'primary_employee_address[country_code]' ).value
I am getting the desired result. However if i try
jQuery( '#primary_employee_address[country_code]' ).val());
I am always getting the result “undefined”. How can i solve the same issue. Any help shall be appreciated.
You need to escape the selector with with
\\if it contains characters that have significance to the jQuery selector engine;