jQuery Selectors: how to access an a tag, whose span has a specific class?
I'm messing around with FullCalendar jQuery calendar, and qTips, so that I can display more information about the event upon mouseover.
I've added a summary element to the FullCalendar js, and also my server code.
I then added a new qTip in the eventMouseover method, based on the span class, which works prefectly. However, if the event stretches over a couple of days, the qTip only works (because it is a span tag), on the text itself, not the entire blue strip.
What I want to do is to assign the qTip to the a tag, and make the a tags display block.
This works currently:
eventMouseover: function(event){
$('span[class=fc-event-title]').each(function() {
if( $(this).text() == event.title )
{
$(this).qtip({
content: event.summary,
style:
{
border:
{
width: 1,
radius: 5,
color: '#6699CC'
},
width: 200
}
});
}
});
but I can't figure out how to select the a tag where it contains a span with class of fc-event-title.
开发者_开发问答Many thanks for any assistance.
If it's a direct child:
$(span[class=fc-event-title]:parent)
Edit: Never mind, I was wrong. Although I do get it to work with the other answer:
$(span[class=fc-event-title]).parent()
$(span[class=myClass]).parent()
Thanks to both Ivo and Jakob for their very quick responses.
I solved this by changing the way the FullCalendar creates the title on the calendar. Instead of it using a span, it now uses a div, and being block element, when you hover over a part of the title block which is not text, the qTip still shows.
I'm loving javascript :).
精彩评论