Ryan Wong Development Blog

Technical Topics I have encountered

Home Archives
2015-03-15
jquery►ajax

Creating JQuery click events for dynamic elements

By: Ryan Wong at Mar 15 2015 6:40 pm

I always forget how to bind events to elements when dynamically loaded when I need it most.

So I decided to make a blog post so I can get the answer really fast.

1
2
3
4
$(document).on('click', '.class', function(ev){
//do something
var data = $(this).attr('data-id');
});
Share Comments
  • dynamic
  • element
  • jquery
Newer
Loading dynamic data with handlebars
Older
Targeting Select box with JQuery

Categories

  • ads1
  • angular16
    • csrf1
    • directive1
      • html1
    • filter4
      • escape html1
      • time ago1
      • trim1
    • form1
    • graph1
    • image1
    • ng-repeat1
    • publish1
      • subscribe1
    • select1
    • stripe1
  • authentication1
  • css1
    • image1
  • express1
    • api1
  • git2
  • gulp1
  • handlebars1
  • ionic11
    • android1
    • carousel1
    • infinite scroll2
    • ios2
    • ngCordova2
      • inappbrowser1
    • oauth1
      • linkedin1
    • sqlite1
  • javascript2
    • distance1
    • hour1
  • jquery6
    • ajax1
    • autocomplete1
    • checkbox1
    • form1
    • select1
  • lamp2
  • laravel6
    • push notification1
    • stripe1
  • learning1
  • magento1
    • categories1
  • mamp2
    • virtualhost1
  • mobile1
  • mongodb1
  • mysql1
    • distance1
  • node3
    • bots1
    • promise1
  • npm1
  • phonegap2
  • php3
    • json1
    • mysql1
  • phpunit1
  • tinymce1
  • ubuntu1

Tags

  • adblock1
  • ads1
  • ajax1
  • android1
  • angular20
  • angular js1
  • apache2
  • api1
  • array1
  • authentication1
  • autocomplete1
  • bots1
  • carousel1
  • categories1
  • checkbox1
  • cordova4
  • csrf1
  • css2
  • date1
  • device1
  • directive1
  • distance2
  • dynamic2
  • element1
  • escape1
  • express2
  • filter4
  • form1
  • git2
  • gps2
  • graph1
  • gulp1
  • handlebars1
  • header1
  • hour1
  • html2
  • id1
  • image3
  • inappbrowser1
  • infinite2
  • input1
  • ionic10
  • ios4
  • javascript2
  • jquery6
  • json1
  • jwt1
  • lamp2
  • laravel8
  • latitude2
  • learning1
  • linkedin1
  • linux1
  • longitude2
  • magento1
  • mamp2
  • mcrypt1
  • mongodb1
  • mysql2
  • ng-repeat1
  • ngCordova2
  • node5
  • npm1
  • phonegap3
  • php6
  • phpunit1
  • plugin1
  • port1
  • post1
  • promise1
  • publish1
  • push notification1
  • radio1
  • scroll2
  • select2
  • sqlite1
  • stripe2
  • submit1
  • subscribe1
  • text1
  • time ago1
  • tinymce1
  • trim1
  • troubleshoot1
  • ubuntu2
  • upload1
  • var1
  • version control1
  • virtualhost1
  • www1

Tag Cloud

adblock ads ajax android angular angular js apache api array authentication autocomplete bots carousel categories checkbox cordova csrf css date device directive distance dynamic element escape express filter form git gps graph gulp handlebars header hour html id image inappbrowser infinite input ionic ios javascript jquery json jwt lamp laravel latitude learning linkedin linux longitude magento mamp mcrypt mongodb mysql ng-repeat ngCordova node npm phonegap php phpunit plugin port post promise publish push notification radio scroll select sqlite stripe submit subscribe text time ago tinymce trim troubleshoot ubuntu upload var version control virtualhost www

Archives

  • April 20161
  • March 20161
  • February 20161
  • January 20161
  • December 20151
  • November 20151
  • October 20151
  • September 20151
  • August 20151
  • July 201512
  • June 201510
  • May 201524
  • April 201512
  • March 20154
  • February 20151

Recents

  • When to use PHP vs NodeJS
  • Angular File Structure
  • twitter-widget
  • Useful Gulp Task
  • learning to learn
© 2016 Ryan Wong
Reticulum Technology Inc.
Home Archives