Handling an ID's special characters in jQuery

/ Published in: jQuery
Save to your folder(s)

One must escape "special characters" in id names using two backslashes.

Copy this code and paste it in your HTML
  1. // incorrect
  2. $('#my.id.name').val();
  4. // correct
  5. $('#my\\.id\\.name').val();

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.