336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

안녕하세요. URL주소를 가져오는 방법을 알려드릴께요

 

1
2
3
4
5
6
7
8
9
<script>
    window.onload = function(){
        //전체주소
        console.log("url : "+location.href);
 
        //http:, localhost:port번호, index.html ?test=tttt 순으로 나누어져 있습니다.
        console.log("url : "+location.protocol+"//"+location.host+""+location.pathname+""+location.search);
    }
</script>
cs
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

안녕하세요. 이번엔 html의 attribute를 이용해서 처리하는 방법을 알려드릴께요

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<meta charset="utf-8"/>
<html>
<head>
<title>JDK의 블로그</title>
 
<!-- jquery를 불러옵니다. jquery.com download 페이지를 참조해주세요 -->
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
 
<script language="javascript">
    $(document).ready(function(){
        //같은 event를 여러개로 지정했습니다.
        //input[id] input 태그중에서 ID속성을 가지고 있는지
        //span태그의 class=jdkddd인 경우만
        //span의 class가 og가 아닌경우
        //input class가 te로 시작하지 안는경우
        //input name가 kd로 포함하는 경우
        $("input[id], span[class='jdkddd'], span[class$='og'], input[class^='te'], span[name*='kd']").click(function(){
            alert("jdk's blog Jquery");
        });
    });
</script>
</head>
<body>
<input type='button' class='test' value='버튼'/>
 
<input type='button' id='test' value='버튼'/><br/>
<span class='jdkddd'>버튼1</span><br/>
<span name='kd'>버튼2$</span><br/>
<div>
    <span class='blog'>div 버튼안에span</span>
</div>
</body>
</html>
cs

 

 

336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

안녕하세요 jquery에서 seleter와 click이벤트에 대해서 알아보겠습니다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<meta charset="utf-8"/>
<html>
<head>
<title>JDK의 블로그</title>
 
<!-- jquery를 불러옵니다. jquery.com download 페이지를 참조해주세요 -->
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
 
<script language="javascript">
    $(document).ready(function(){
        //같은 event를 여러개로 지정했습니다.
        //#test는 ID가 test의 경우에 처리합니다.
        //.test는 Class가 test의 경우에 처리합니다.
        //span은 태그 이름이 span인 경우 처리합니다.
        //div.span은 div태그 밑에 span태그인 경우에 처리합니다.
        $("#test,.test,span,div.span").click(function(){
            alert("jdk's blog Jquery");
        });
    });
</script>
</head>
<body>
<input type='button' class='test' value='버튼'/>
 
<input type='button' id='test' value='버튼'/><br/>
<span>버튼</span><br/>
<div>
    <span>div 버튼안에span</span>
</div>
</body>
</html>
cs

 

 

 

 

 

'JQUERY' 카테고리의 다른 글

북마크 JQUERY 사용하기  (0) 2016.07.08
JQUERY 간단한 selector 이렇게 하면 좋을거같아요  (0) 2016.07.06
JQUERY 불러오기 참 간단하죠~  (0) 2016.07.06
JQUERY url 주소가져오기  (0) 2015.11.30
JQUERY attribute 쓰기  (0) 2015.11.29

+ Recent posts