Programming/jquery2018. 12. 5. 17:07



alert($("#dropDownMenuKategorie")[0].selectedIndex);


Update:

Since version 1.6 jQuery has the prop method that can be used to read properties:

alert($("#dropDownMenuKategorie").prop('selectedIndex'))

[링크 : https://stackoverflow.com/questions/13556941/get-index-of-selected-option-with-jquery]

'Programming > jquery' 카테고리의 다른 글

jquery ajaxsetup()  (0) 2018.12.14
jquery draggable  (0) 2018.12.09
jquery 셀렉터 - 특정 문장으로 시작하는 id 찾기  (0) 2018.11.07
jquery prepend  (0) 2018.11.06
jquery를 이용하여 특정 테이블의 열로 이동하기  (0) 2018.11.06
Posted by 구차니
Programming/jquery2018. 11. 7. 19:20

정규표현식을 이용하면 됨


$('tag[id^="문장"])


div의 id가 asdf로 시작할 경우


$('div[id^="asdf"])


[링크 : http://jmi7313.tistory.com/16]

'Programming > jquery' 카테고리의 다른 글

jquery draggable  (0) 2018.12.09
jquery select 인덱스 얻기  (0) 2018.12.05
jquery prepend  (0) 2018.11.06
jquery를 이용하여 특정 테이블의 열로 이동하기  (0) 2018.11.06
jquery eq() get() 차이  (0) 2018.11.05
Posted by 구차니
Programming/jquery2018. 11. 6. 18:57

append는 추가하는 거라 추가하려는 위치의 가장 뒤에 들어간다면

prepend는 추가하려는 위치의 가장 앞에 끼어넣는다. insert에 가깝다고 하면 되려나?


[링크 : http://api.jquery.com/insertBefore/]

[링크 : http://api.jquery.com/insertAfter/]

[링크 : http://api.jquery.com/prepend/]

Posted by 구차니
Programming/jquery2018. 11. 6. 16:05

표의 특정 라인으로 이동하기

특절 라인에 대해서 length로 받고 윈도우의 scroll로 직접 이동..


이런걸 써서.. 페이지 이동시 딱딱 끊어지게 하는건가?


var w = $(window);

var row = $('#tableid').find('tr').eq( line );


if (row.length){

    w.scrollTop( row.offset().top - (w.height()/2) );

[링크 : https://stackoverflow.com/questions/7852986/javascript-scroll-to-nth-row-in-a-table]

'Programming > jquery' 카테고리의 다른 글

jquery 셀렉터 - 특정 문장으로 시작하는 id 찾기  (0) 2018.11.07
jquery prepend  (0) 2018.11.06
jquery eq() get() 차이  (0) 2018.11.05
jquery selector와 document.getElementById 차이  (0) 2018.11.05
jquery trigger()  (0) 2018.10.25
Posted by 구차니
Programming/jquery2018. 11. 5. 14:34

get은 DOM 객체를 받는다면

eq는 jquery 객체를 받는 차이가 있다.


그래서 이전에.. canvas를 얻었을때 width나 scrollwidth 같은게

jquery 통해서 획득한 녀석은 받아내질 못했던 것으로 보인다.


Retrieve the DOM elements matched by the jQuery object. 

[링크 : https://api.jquery.com/get/]


Reduce the set of matched elements to the one at the specified index. 

[링크 : https://api.jquery.com/eq/]


[링크 : http://www.jquerybyexample.net/2013/04/jquery-difference-between-eq-and-get-method.html]

[링크 : https://fronteer.kr/bbs/view/250]



Posted by 구차니
Programming/jquery2018. 11. 5. 14:32

jquery 의 셀렉터로 잡은 녀석과

document.getElementById 로 잡은 녀석이 접근 가능한 내용이 다른데

원인은 jquery는 jquery에서 만든 object를 사용하고

document.getElementById 은 Object를 사용하기 때문

즉, 같은 객체가 아니기에 접근 가능한 항목이 다르다~


[링크 : https://www.simonewebdesign.it/difference-between-getelementbyid-jquery/]

[링크 : https://www.quora.com/What-are-the-differences-between-foo-and-document-getElementById-foo]

[링크 : https://api.jquery.com/get/]

'Programming > jquery' 카테고리의 다른 글

jquery를 이용하여 특정 테이블의 열로 이동하기  (0) 2018.11.06
jquery eq() get() 차이  (0) 2018.11.05
jquery trigger()  (0) 2018.10.25
jqeury ajax 수행 완료 기다리기  (0) 2018.10.23
jquery ajax data, header  (0) 2018.10.23
Posted by 구차니
Programming/jquery2018. 10. 25. 15:45

버튼 누르면 어떠한 다른 곳을 누르는 행위를 하고 싶을때(예를 들면 탭)

trigger('click') 으로 해당 핸들러에 click 이벤트를 트리거 해준다.


[링크 : http://findfun.tistory.com/325]


+

click()은.. trigger()와는 전혀 별개인가?


click()은 이벤트 핸들러를 바인드 한다.

즉, click()은 onclick() 이벤트를 생성해 주는 역활이라고 보면되고

그 onclick() 이벤트 자체를 발생시키려면 trigger('click')을 해주어야 한다.. 인가?

Description: Bind an event handler to the "click" JavaScript event, or trigger that event on an element. 

[링크 : http://api.jquery.com/click/]

'Programming > jquery' 카테고리의 다른 글

jquery eq() get() 차이  (0) 2018.11.05
jquery selector와 document.getElementById 차이  (0) 2018.11.05
jqeury ajax 수행 완료 기다리기  (0) 2018.10.23
jquery ajax data, header  (0) 2018.10.23
jquery shake  (0) 2018.10.16
Posted by 구차니
Programming/jquery2018. 10. 23. 17:16

포인트(?)는 ajax에서 return $.ajax()를 해주어야 한다는 것


$.when(ajax1(), ajax2(), ajax3(), ajax4()).done(function(a1, a2, a3, a4){

    // the code here will be executed when all four ajax requests resolve.

    // a1, a2, a3 and a4 are lists of length 3 containing the response text,

    // status, and jqXHR object for each of the four ajax calls respectively.

});


function ajax1() {

    // NOTE:  This function must return the value 

    //        from calling the $.ajax() method.

    return $.ajax({

        url: "someUrl",

        dataType: "json",

        data:  yourJsonData,            

        ...

    });

[링크 : https://stackoverflow.com/questions/3709597/wait-until-all-jquery-ajax-requests-are-done]

'Programming > jquery' 카테고리의 다른 글

jquery selector와 document.getElementById 차이  (0) 2018.11.05
jquery trigger()  (0) 2018.10.25
jquery ajax data, header  (0) 2018.10.23
jquery shake  (0) 2018.10.16
jquery ani arc  (0) 2018.10.16
Posted by 구차니
Programming/jquery2018. 10. 23. 16:38

get의 header로 보낼때는 header 인가..

post의 body는 data


[링크 : https://stackoverflow.com/questions/3258645/pass-request-headers-in-a-jquery-ajax-get-call]

'Programming > jquery' 카테고리의 다른 글

jquery selector와 document.getElementById 차이  (0) 2018.11.05
jquery trigger()  (0) 2018.10.25
jqeury ajax 수행 완료 기다리기  (0) 2018.10.23
jquery shake  (0) 2018.10.16
jquery ani arc  (0) 2018.10.16
Posted by 구차니
Programming/jquery2018. 10. 16. 16:12

animation을 쓰지 않아도 되는 녀석으로 발견


<script>

$( document ).click(function() {

  $( "#toggle" ).effect( "shake" );

});

</script> 

[링크 : https://api.jqueryui.com/shake-effect/]

'Programming > jquery' 카테고리의 다른 글

jquery selector와 document.getElementById 차이  (0) 2018.11.05
jquery trigger()  (0) 2018.10.25
jqeury ajax 수행 완료 기다리기  (0) 2018.10.23
jquery ajax data, header  (0) 2018.10.23
jquery ani arc  (0) 2018.10.16
Posted by 구차니