Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class='square' id='sq12'><p class='text'><br/>"Text I want to fetch"</p></div>
- Cannot read property 'getElementsByClassName' of null
- $('body').on('click', '.square', function(e)
- {
- var fetchedText = document.getElementById(e.target.id).getElementsByClassName('text')[0].innerHTML;
- alert(fetchedText);
- });
Add Comment
Please, Sign In to add comment