이 시도 :
$('input[type=text]').not('input[type=text]#MyOtherInput').bind('keydown', function(e)
{
............
});
그것은 예를 아래에 myotherinput control.Try 제외하고 텍스트를 입력 모든 입력을 선택합니다.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body>
<div id="testdiv">
<input id="Text1" type="text" /><br />
<input id="Text2" type="text" /><br />
<input id="Text3" type="text" /><br />
<input id="Text4" type="text" /><br />
<input id="Text5" type="text" /><br />
<input id="Text6" type="text" /><br />
<input id="MyOtherInput" type="text" />
</div>
</body>
<script type="text/javascript">
$(function()
{
$('input[type=text]').not('input[type=text]#MyOtherInput').bind('keydown', function(e)
{
alert('Common for all ');
});
$('input[type=text]#MyOtherInput').bind('keydown', function(e)
{
alert('Only for MyOtherInput');
});
});
</script>
</html>
및 2 개의 예외가 있습니까? –
그 클래스의 이름이 testclass라는 가정하에 두 개의 컨트롤에 별도의 클래스를 할당하십시오. 코드는 다음과 같을 것입니다 : $ ('input [type = text]'). not ('input [type = text] .testclass') ......... – Raghav