jerdiggity jerdiggity - 1 year ago 45
Javascript Question

jQuery: How do I identify an element whose ID contains a dot?

Here is my current code:

jQuery(document).ready(function($) {
$("#edit-name").change(function() {
$("#edit-pass-pass1").change(function() {
$("#edit-pass-pass2").change(function() {

Everything works fine, except for updating the value of the element whose ID is
. The reason seems pretty apparent to me (that jQuery is getting confused after seeing
right next to each other) but maybe that's wrong...

Regardless, the ID can't be changed because it's being sent to a remote endpoint and it needs to match on that end.

So my question is: is there a way to tell jQuery that
is an ID (and not a class)?

Answer Source

yes you can do this by escape it.