country-select-js
country-select-js copied to clipboard
tag id contains dots
Hi,
Great extension. I am using it in a project where the element ids contain dots and jQuery does not like them.
so I escape them using the standard way:
jQuery("#user\\.attributes\\.country").countrySelect();
in order to initiate the countrySelect. Although this fails with the _code field.
I suggest a change where by one can pass in an additional id to define where to store the code for the country. Also to remain backwards compatible. Perhaps you could also escape dots -> when you are looking for the element in the code ->
this.countryCodeInput = $("#"+this.countryInput.attr("id")+"_code");
What do you think ?
That seems like a perfectly reasonable solution to the problem if naming the field to not have dots is not an option for your project (which is good practice in general).
So something like this to avoid the problem with periods in the ID string?
var inputId = this.countryInput.attr("id");
this.countryCodeInput = $('input[id='+inputId+"_code");
If that resolves your issue, then fair enough, and we can get that packaged up and merged in.