label for support for id's with brackets, eg id="name[first]" #422

Closed
phazei opened this Issue Sep 17, 2012 · 2 comments

Comments

Projects
None yet
3 participants

phazei commented Sep 17, 2012

Near line 520 needs to be modified like so:

        target=$(e.target);
        attr = target.attr("for");
        if ("LABEL" === e.target.tagName && attr && attr.length > 0) {
            attr = attr.replace(/([\[\]])/g,'\\$1');
            target = $("#"+attr);
            if (target.data("select2") !== undefined) { target.select2('open'); e.preventDefault();}
        }

I also added
$("#"+attr).select2('open');
since target.focus() didn't seem to open the select.

@ivaynberg ivaynberg closed this in f7e78f6 Sep 18, 2012

Does this issue also affect name attributes?

phazei commented Sep 22, 2012

It shouldn't, it worked just fine for me with brackets in the names
On Sep 21, 2012 6:29 AM, "Petrus" notifications@github.com wrote:

Does this issue also affect name attributes?


Reply to this email directly or view it on GitHubhttps://github.com/ivaynberg/select2/issues/422#issuecomment-8764612.

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