jQuery语法错误,无法识别的表达式:[name = Basics.Gender] [英] jQuery Syntax error, unrecognized expression: [name=Basics.Gender]

查看:96
本文介绍了jQuery语法错误,无法识别的表达式:[name = Basics.Gender]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从jQuery 1.4.4升级到jQuery 1.7.2,我收到语法错误。我认为这是由于选择器的Basics.Gender部分中的'。'。

I am upgrading from jQuery 1.4.4 to jQuery 1.7.2 and I get a syntax error. I think its due to the '.' in the Basics.Gender part of the selector.

$('[name=Basics.Gender]')

任何人对如何解决这个问题都有任何建议吗?

Anyone have any suggestions on how to fix this?

http://jsfiddle.net/2nBc9/

编辑

任何人都知道为什么'。'现在打破了选择器语法?他们在Sizzle中使用正则表达式还是其他东西?或者将属性放在引号中始终是最佳做法?

Anyone know why the '.' breaks the selector syntax now? Are they using regex's or something in Sizzle? Or has it always been best practice to put the attribute in quotes?

推荐答案

引用值:

$('div[name="Basics.Gender"]')

http://jsfiddle.net/7Pqhc/

这篇关于jQuery语法错误,无法识别的表达式:[name = Basics.Gender]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆