如果jquery要选择的元素id中带有点符号,在选择时需要在点前面加上两个反斜杠,如:
$(“#address\\.street”).text(“Enter this field”);
<!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title> http://www.75271.com demo</title> <script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script> <script type='text/javascript'>//<![CDATA[ $(window).load(function(){ //http://www.75271.com $("#address\\.street").text("Enter this field"); });//]]> </script> </head> <body> <div id="address.street"> http://www.75271.com </div> </body> </html>