日期:2014-05-17  浏览次数:20756 次

css属性选择器的问题,貌似css有问题。
input[id^="256"]  input[id^="256aa"]  为什么这两个用css选择器都会匹配到下面这个input呢?是不是css属性选择有BUG?

<input id="256" type="text" name="256"/>

------解决方案--------------------
不会吧。 我测试没发现
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<script>
$(document).ready(function(){
  $("p").click(function(){
var t=$("input[id^=256]").val();
var t1=$("input[id^=256aa]").val();
alert(t);
alert(t1);
    $(this).hide();
  });
});
</script>
</head>
<body>
<input id="256" type="text" name="256" value="333"/>
<p>如果您点击我,我会消失。</p>
<p>点击我,我会消失。</p>
<p>也要点击我哦。</p>
</body>
</html>