Skip to content

Instantly share code, notes, and snippets.

@dacur
Created October 9, 2014 20:43
Show Gist options
  • Select an option

  • Save dacur/259b3dbbe48057c885c9 to your computer and use it in GitHub Desktop.

Select an option

Save dacur/259b3dbbe48057c885c9 to your computer and use it in GitHub Desktop.
Get the value of a Div (from a row of Divs that were clicked) that was dynamically created. See notes in code below.
$('.catRow').on('click', function(){
var catEditing = $(this).html(); //All divs in row
var catName = $(catEditing).closest('.catName').text();
alert(catName);
})
For example, you are dynamically creating rows of data that are given from the DB.
Each row is clickable.
To find the Name (catName; i.e. 'category name') of the clicked row, use this code!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment