Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag id contains dots #42

Open
istvano opened this issue Apr 10, 2017 · 1 comment
Open

tag id contains dots #42

istvano opened this issue Apr 10, 2017 · 1 comment
Assignees

Comments

@istvano
Copy link

istvano commented Apr 10, 2017

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 ?

@mrmarkfrench
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants