Reputation: 197
this is my HTML file :
<a class="fc-time-grid-event fc-event fc-start fc-end fc-draggable fc-resizable" style="top: 703px; bottom: -791px; z-index: 1; left: 0%; right: 0%;">
<div class="fc-content"><div class="fc-time" data-start="4:00" data full="4:00 PM"><span>4:00</span></div>
<div class="fc-title">Work Order 1003</div>
<div class="fc-bg"></div>
<div class="fc-resizer"></div>
</a>
I got the children content 'div.fc-title' using this code line $('div').on('click', 'div.fc-content', function(e) { alert($(this).children('.fc-title').text())
On the other hand, I couldn't get it from the parent 'a' down to 'fc-title'.
Upvotes: 0
Views: 65
Reputation: 1342
A minor modification to your script and it's done!
JS:
$('a').on('click', function(e) {
e.preventDefault();
alert($(this).children('.fc-title').text());
});
Upvotes: 0
Reputation: 388316
You could try to bind the handler to document
object instead
$(document).on('click', 'div.fc-content', function (e) {
alert($(this).children('.fc-title').text())
})
Demo: Fiddle
Upvotes: 1