且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用jQuery获取样式标记内容?

更新时间:2023-11-25 17:35:34

我认为你必须逃避你的冒号角色ID,因为它通常意味着选择器语法中的某些内容。请参阅在元素ID中处理冒号CSS选择器,用于讨论此问题。

I think you have to escape the colon character in your ID because it would normally mean something in the selector syntax. See Handling a colon in an element ID in a CSS selector for a discussion of this issue.

$('#less\\:concepts-less-css-style')

我个人在我的ID或类值中避免使用带有CSS选择器的特殊字符避免这种复杂化。

I personally avoid special characters with CSS selector meaning in my ID or class values to avoid this complication.