0

Im trying to setup a bit of javascript to detect when the title of an event is clicked and when it is clicked click another link, if that makes sense.

Just realized it would have to click the link within the event card itself.

Frontend

this is the code I have:

var eventTitle = $(".eventCardCnt .title");
var eventMoreInfo = $(".custom_button").find("a");

    eventTitle.click( function(){
       eventMoreInfo.trigger("click");
        //console.log("title clicked");
    });

html:

        <div class="eventCardCnt eventDisplayCnt  isAnEvent" >
        <div class="cntHolder" >
        <div class="details">
        //  When this is clicked.
        <span class="title">Understanding ‘Prevent Duty’ & Radicalisation</span>
        <div class="dateDetails" style="color:#999999; font-size:14px; line-height:120%;font-weight:normal; padding:3px 0px; padding-bottom:0px;text-align:left; margin-bottom:5px; margin-top:0px; border-bottom:0px solid #EEEEEE;">
        <div class="dateCnt">
        <div class="dates">
        <div class="dateWrap">
        <div class="date">Wednesday 10 February 2016</div>
        <div class="time">9:30 am</div>
        </div>
        </div>
        </div>
        </div>
        <span class="location"><a href="http://maps.google.com/?q=Holiday+Inn,+Camden+Lock,+London" target="_blank">Holiday Inn, Camden Lock, London</a></span>
        <div class="eventDetails">
        <div class="price" >£250.00</div>
        <div class='custom_button'>
        <div class="more_info_button">
        //  Click this link
        <a href="http://carleyconsult.wp.castus1.co.uk/product/understanding-prevent-duty-radicalisation/">More info and book</a>
        </div>
        </div>
        </div>
        </div>
        </div>
        </div>

any Ideas would be greatly appreciated.

JoshTalk
  • 67
  • 5

2 Answers2

0

You can use click event in the heading click event like $(".link").click();:

$(".header").click(function(){
    $(".link").click();
});
$(".link").click(function(){
    alert("Another link Clicked");
});
0

Try This code HTML PAGE

<div class="eventCardCnt eventDisplayCnt  isAnEvent" >
        <div class="cntHolder" >
        <div class="details">
        //  When this is clicked.
        <span class="title" onclick="clickhref()" >Understanding ‘Prevent Duty’ & Radicalisation</span>
        <div class="dateDetails" style="color:#999999; font-size:14px; line-height:120%;font-weight:normal; padding:3px 0px; padding-bottom:0px;text-align:left; margin-bottom:5px; margin-top:0px; border-bottom:0px solid #EEEEEE;">
        <div class="dateCnt">
        <div class="dates">
        <div class="dateWrap">
        <div class="date">Wednesday 10 February 2016</div>
        <div class="time">9:30 am</div>
        </div>
        </div>
        </div>
        </div>
        <span class="location"><a href="http://maps.google.com/?q=Holiday+Inn,+Camden+Lock,+London" target="_blank">Holiday Inn, Camden Lock, London</a></span>
        <div class="eventDetails">
        <div class="price" >£250.00</div>
        <div class='custom_button'>
        <div class="more_info_button">
        //  Click this link
        <a id="aclick" href="http://carleyconsult.wp.castus1.co.uk/product/understanding-prevent-duty-radicalisation/">More info and book</a>
        </div>
        </div>
        </div>
        </div>
        </div>
        </div>

JAVASCRIPT

function clickhref()
{
     $("#aclick").click();
}