웹브라우저 JavaScript

jQuery 이벤트

jQuery는 이벤트와 관련해서 편리한 기능을 제공한다.  아래 예제는 직접 이벤트 프로그래밍을 하는 것과 jQuery를 이용하는 것의 차이점을 보여준다. (실행)

<input type="button" id="pure" value="pure" />
<input type="button" id="jquery" value="jQuery" />
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
    // 순수하게 구현했을 때
	var target = document.getElementById('pure');
	if(target.addEventListener){
		target.addEventListener('click', function(event){
			alert('pure');
		});
	} else {
		target.attachEvent('onclick', function(event){
			alert('pure');
		});
	}

    // jQuery를 사용했을 때
	$('#jquery').on('click', function(event){
		alert('jQuery');
	})
</script>

코드 분량에 큰차이가 있다. jQuery는 크로스 브라우징을 알아서 처리해주고, 이벤트를 보다 적은 코드로 구현할 수 있도록 해준다. 이런 이유 때문에 jQuery와 같은 라이브러리를 사용하는 것이다. 

댓글

댓글 본문
  1. anne
    완료
  2. thomaslist
    https://www.atlanticralphlauren.com Ralph Lauren Polos
    https://www.coachfactory-outlet.com cheap big coach
    https://www.polooutletsfactorystore.us.com Shop Ralph Lauren Polos Best Sellers
    https://www.pandorahearts.us.com Pandora Gifts Amazing Selection
    https://www.coachfactory.uk Coach Handbags UK Shop
    https://www.airjordanshoes.in.net Home Nike Air Jordan Outlet
    https://www.edhardy.us.org Ed Hardy Reliable Quality
    https://www.supremeclothingonline.us.com Mens Supreme Clothing
    https://www.coachhandbagsoutlets.us.com Largest Fashion Store Coach
    https://www.katespadestyle.com Kate Spade New York Outlet
    https://www.adidasyeezyboost-350.us.com Discounted Adidas Falcon
    https://www.specialairshoes.com By Fashion Nike Air Max 97
    https://www.newcoachoutlet.com Lowest Price Coach Online
    https://www.laurenralphlauren.us Reasonable Price Ralph Lauren
    https://www.nike-factory.us.com Air Max 720 USA Online
    https://www.prloutletclothing.com Shop Ralph Lauren Winter Clothes
    https://www.champions.us.com Champion Short T Shirt
    https://www.ralphlaurenpopular.com Buy Real Ralph Lauren Track Suits
    https://www.donedhardy.us.com Huge Ed Hardy Discount
    https://www.polorlpony.com Polo Ralph Lauren Pony Sale USA
    https://www.airmax-97.us.com Nike Air Max Plus USA Fashion
    https://www.ralphlaurenponyoutlet.com Cheapest Polo Ralph Lauren Price
    https://www.nikeoutletsfactory.us.com Nike Blazer USA Factory
    https://www.ggdbitaly.com Golden Goose Sneakers White
    https://www.atlantichogan.com Hogan Sneakers Reasonable Sale Price
    https://www.katespademore.com Kate Spade New York
    https://www.edhardysurprise.com ED Hardy Surprise Clothing
    https://www.atlanticairjordan.com Exclusive Range Air Jordan
    https://www.adidas.in.net Newest Adidas Ultra Boost
    https://www.supremeny.us.com Supreme Sweatshirts Europe
    https://www.poloralphoutlet.us.com Super Quality Ralph Lauren Womens Shirts
    https://www.salomonfrance.com Salomon Speedcross GTX for men
    https://www.polooutlet.us.com Cheap Clothes Women Ralph Lauren
    https://www.deepedhardy.com ED Hardy Cheapest Online Price
    https://www.air-max2018.us.com Fashion Air Max 97 Store
    https://www.polooutlet.uk Ralph Lauren Shop Now
    https://www.scarpehogans.it Unique Hogan Sneakers
    https://www.adidasoriginals.in.net Adidas NMD Boost USA Cheap Sale
    https://www.off-whiteitaly.com Off White Factory Store
    https://www.airjordan4.us.com Nike Air Jordan New York
    https://www.pandoraholiday.com Pandora Rings UK Online Shop
    https://www.edhardyoriginals.top Ed Hardy Love Kill Slowly
    https://www.katespadenew.com Kate Spade Crossbody
    https://www.coachus.us.com Coach Cross Body Store Online
    https://www.atlanticcoach.co.uk Coach Clutches Projects Sale
    https://www.authenticadidas.com USA Adidas NMD Boost For Women
    https://www.cheap-jordansshoes.us.com Nike Air Jordan Sport
    https://www.jordanshoesforsale.us.com Outlet Nike SB Dunk Online
    https://www.offwhitetshirt.us.com OFF White USA Top Brand Wholesale Online
    https://www.ralphlaurenclassic.org.uk Polo Ralph Lauren retail prices
    https://www.edhardysoriginals.com Ed Hardy For Women
    https://www.palace.us.com Palace Jackets Outlet UK
    https://www.authentic-boost.com Lowest Price Adidas NMD Boost
    https://www.edhardys.us New Ed Hardy Products
    https://www.superstaradidas.us.com Adidas Boost Outlet Sale
    https://www.katespadeoutlet-store.us.com Kate Spade Lowest Price Online
    https://www.poloralphlaurenbrand.com Polo Ralph Lauren Competitive Price
    https://www.katespadeoutletnewyork.us.com Kate Spade Official supplier
    https://www.multigroundboots.com Special Soccer Offers
    https://www.justinairmax.com Nike Air VaporMax USA Online
    https://www.adidas-nmds.us.com Adidas Yeezy Boost Sale
    https://www.usapandorauk.com Home Pandora Necklaces UK
    https://www.championoutlet.us.com Champion Factory Outlet Price
    https://www.poloralphlaurenpolo.uk.com Ralph Lauren Cheap Prices
    https://www.pacificsneakers.com Nike Air Jordan Open Store
    https://www.prloutlet.co.uk Polo Ralph Lauren UK Outlet
    https://www.polooutletoutlet.us.com Polo Ralph Lauren Shirts Most Fashionable Outlet
    https://www.ed-hardy.uk.com cheap prices Ed Hardy UK
    https://www.coachsurprise.us.com Coach Wallets Outlet USA
    https://www.ralphlaurenworldwide.com Discount Polo Ralph Lauren Clothing
    https://www.adidasrealboost.com Adidas Shoes USA Factory Outlet
    https://www.atlanticairmax.com Nike Air Max US In Store
    https://www.lovekillsslowly.us Christian Audigier Online
    https://www.kate-spadeoutletstore.us.com Hottest Kate Spade New Styles
    https://www.atlanticpolo.co.uk Ralph Lauren Polo outfit for women
    https://www.airmaxsurprise.com Nike Air Max 90 For Women
    https://www.polooutletstore.us.org PRL Jackets Outlet Locations
    https://www.adidasmix.com Adidas Yeezy Real Boost 350
    https://www.atlanticpandora.com Pandora Necklaces Free Shipping
    https://www.poloralphlaurensport.com Polo Ralph Lauren Black White
    https://www.coach-bags.org us Coach leathers
    https://www.jordanshoes.in.net Nike Blazer Top Designer Collections
    https://www.salomonshoes.in.net Salomon Speedcross Plus
    https://www.coach-factoryoutletstore.com coach crossbody designer
    https://www.katespadeoriginals.com Discount Kate Spade Satchel
    https://www.airjordanmid.com Air Jordan Low For Cheap
    https://www.authenticgoldengoose.com Large Discount Golden Goose Francy
    https://www.poloralphlaurenbusiness.com Polo Ralph Lauren Jackets
    https://www.edhardy.org.uk Ed Hardy Jeans outlet shop online
    https://www.coachcolorful.us.com Coach Handbags Sale
    https://www.ralphlaurencolorfuls.com Ralph Lauren Outlet Factory
    https://www.katespadesale.us.com Kate Spade Discount
    https://www.coachoutlet.org.uk Coach Handbags Wholesale UK
    https://www.poloralphlauren-sale.us.com USA Ralph Lauren Vest Men
    https://www.coachoutlet-handbags.com Coach Totes outlet for sale
    https://www.nikeshoesoutlet.us.org Nike LeBron Great Deals
  3. 한강
    jQuery가 더 편이하네요~~!!!
    200714
  4. thomaslist
    <a href="http://uggbots.misblkfriday.com">uggs</a>
    [url=https://www.ok-text-online.com]OK Text Online[/url]
    https://www.ok-text-online.com
    http://www.ok-text-online.com
  5. 준바이
    감사합니다
  6. 굼벵이
    완료
  7. JuicyFresh
    감사합니다.
  8. 박인호
    1-3
    수강완료.
    jQuery는 크로스브라우징 이슈를 간단하게 커버할 수 있다.
  9. Byungsoo Kim
    감사합니다. >>>
  10. illliilllliillliii
    -ㅁ-!! 하나의 예제이긴하지만 jQuery를 배우지 않는 것은 엄청난 손해로군요
    잘봤습니다
  11. crable
    감사합니다.
  12. Bamdle
    감사합니다 ^^
  13. Byeong Heon Lee
    항상 감사합니다~
  14. 신입1
    감사합니다
  15. tachyon
    감사합니다
  16. JustStudy
    2016.07.14 목
    고맙습니다 3.
  17. JustStudy
    2016.07.03 일
    고맙습니다 2.
  18. 온달장군
    강좌 잘보고 갑니다. 감사합니다.
  19. 이주환
    2016. 04. 28
    잘보고갑니다.
  20. JustStudy
    고맙습니다
  21. WayneKing
    코딩시간 엄청 줄어들것 같네요.
  22. 2015-11-13 금요일 비옴....
    잘 봤습니다.
    저녁 시간에는 동영상이 끊기고 느려지는데 접속자가 많아서 그런거겠죠?
    ....
  23. 호두과자
    감사합니당~
  24. 코딩!
    감사합니다!
  25. egoing
    방금 처리했습니다. 알려주셔서 감사합니다!
    대화보기
    • FOrcePlane
      항상 좋은 수업 덕분에 너무 감사드립니다!
      그런데 youtube로 연속해서 보고 있는데, 이벤트 부분하고 ajax, JSON부분하고 강의 순서가 엉켜있습니다.
      이게 수정이 가능한지는 모르겠네요 ㅎㅎ

      아무튼 항상 좋은 수업보고 있습니다. 감사드립니다!
    버전 관리
    egoing
    현재 버전
    선택 버전
    graphittie 자세히 보기