Created
October 9, 2014 20:43
-
-
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('.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