下面这段代码,没有办法获取到 <div><ff></div>
$("div:contains('<ff>')").each(function(i) 改成 $("div:contains('<ff>')").each(function(i) 也不行
我现在想要查找包含指定字符串的对象,而且也不能是模糊查找,我知道改成div:contains('ff')")是可以查找到,但是如果有多个元素包含ff就都会找到……
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script>
function xx() {
$("div:contains('<ff>')").each(function(i) {
// if ($(this).text() == '<ff>') {
// $(this).hide();
// }
alert($(this).text());
});
}
</script></head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" type="button" value="button" onclick="xx()" /></div>
<div>
<div>a</div>
<div><ff></div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
$("div:contains('<ff>')").each(function(i) 改成 $("div:contains('<ff>')").each(function(i) 也不行
我现在想要查找包含指定字符串的对象,而且也不能是模糊查找,我知道改成div:contains('ff')")是可以查找到,但是如果有多个元素包含ff就都会找到……
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title> <script src="jquery-1.4.2.min.js" type="text/javascript"></script> <script>
function xx() {
$("div:contains('<ff>')").each(function(i) {
// if ($(this).text() == '<ff>') {
// $(this).hide();
// }
alert($(this).text());
});
}
</script></head>
<body>
<form id="form1" runat="server">
<div>
<input id="Button1" type="button" value="button" onclick="xx()" /></div>
<div>
<div>a</div>
<div><ff></div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
$("div:contains('<ff>')")
你这个涉及的特殊字符,不知道jquery是否支持
$("div:contains('\<ff\>')")
是否可行