//搜索内容
var loc = $("#unitType").val();
//搜索内容所在元素下遍历
$("caption").each(function() {
if($(this).children().children().text()==loc){
//定位id属性
$(this).attr('id','test');
//跳转到id位置
window.location.hash = "#test";
$(this).children("a").click();
}
//清除id
$(this).removeAttr('id');
});
js在页面搜索定位某一元素的位置
最新推荐文章于 2024-04-29 23:01:06 发布