总结以下两个:
http://dfch84.iteye.com/blog/1161785
http://www.iteye.com/problems/27397
jquery选择器很强大,但是用id选择时,id中如果有特殊字符,如点操作符'.',则无法获取到页面元素对象。
<s:hidden id="pagination.currentPage" name="pagination.currentPage" />
方法1: 使用\\对 . 进行转义
$("#pagination\\.currentPage").val(1);
方法2: 可以通过属性选择器来解决:
//采用属性选择器
$('input[id="pagination.currentPage"]').val(1);
本文介绍了在使用jQuery时遇到的问题:当HTML元素的ID包含特殊字符(例如点操作符'.')时,如何正确地选取这些元素。提供了两种解决方案:一种是对特殊字符进行转义;另一种是使用属性选择器。
1094

被折叠的 条评论
为什么被折叠?



