$(':text').메서드()
이런형식으로 쓰시면 모든 input type="text" 형식의 태그들이 타겟으로 설정됩니다.
02.Text.htm |
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<title>Text 박스의 값 복사</title>
<style type="text/css">
.silver { background-color:Green;
}
</style>
<script src="../jQuery/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{ // 모든 텍스트박스의 배경을 Silver로 설정 $(':text').addClass("silver"); // 첫번째 텍스트박스의 값을 두번째 텍스트박스로 복사 $('#btnCopy').click(function() { $('#txtID').val($('#txtUserID:text').val()); });
});
</script> </head> <body>
아이디 : <input type="text" id="txtUserID" /><hr />
<input type="button" id="btnCopy" value="복사" /><hr />
아이디 : <input type="text" id="txtID" /> </body> </html> |
결과화면 |
[그림24-1] |
'jQuery | javascript | CSS' 카테고리의 다른 글
26.jQuery - 선택값 가져오기 ( 02.Selectors - 04.Selected ) (0) | 2009.11.09 |
---|---|
25.jQuery - IF문 ( 02.Selectors - 03.PasswordConfirm ) (0) | 2009.11.09 |
23.jQuery - Input ( 02.Selectors - 01.Input ) (0) | 2009.11.09 |
22.jQuery - For문 ( 01.Core- 02.Indexer ) (2) | 2009.11.09 |
21.jQuery - Each() 메서드 ( 01.Core-01.Each ) (0) | 2009.11.09 |
Comments