如果按钮包含值'foo',我正在尝试隐藏它。
下面的代码不起作用,我不明白为什么:
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Example</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("button:contains('foo')").parent('div').hide();
});
</script>
</head>
<body>
<div class="prod_buy">
<input name="Add to Cart" type="submit" class="rb green txtbutton" value="foo">
</div>
</body>
</html>