0

this might be very basic but I am still trying to figure it out because I cannot seem to get it correct.

The button

<a class="fusion-button button-flat button-square button-xlarge button-default button-40" target="_blank"><span class="fusion-button-text fusion-button-text-left">KÖP DITT CAMPINGKORT HÄR!</span></a>

And I need to add this

<a href="Javascript://Camping Key Europe" onclick="CampingKeyEurope(' blank', 'sv')">Köp Camping Key Europe</a>

Some things needs changing such in the next code but you get the idea, how can I make button work, so when they press it it open module? When I use the second code without button and only link, it works fine, module shows up.

Please help :)

3 Answers3

2

Try this

<button type="button" class="fusion-button-text fusion-button-text-left" 
onclick="CampingKeyEurope(' blank', 'sv')">Button Text</button>

Building off the comment by Sterling Archer, you should attach event listeners outside of your HTML, so if you are using JQuery, in your $(document).ready() function you would add your onclick event there to your button like so:

$('.fusion-button-text.fusion-button-text-left').on('click', function() {});
Ryan Wilson
  • 10,223
  • 2
  • 21
  • 40
0

Try using an event listener:

<a id="btn" class="fusion-button button-flat button-square button-xlarge button-default button-40" target="_blank">
  <span class="fusion-button-text fusion-button-text-left">KÖP DITT CAMPINGKORT HÄR!</span>
</a>

document.getElementById('btn').onclick = function () { 
  CampingKeyEurope(' blank', 'sv');
};
DreamTeK
  • 32,537
  • 27
  • 112
  • 171
0

I suggest looking through here, Its very useful: https://www.w3schools.com/jsref/event_onclick.asp

  • Thatsnks for posting an answer its what makes this community work. Pages from W3schools can be an unreliable source and are generally frowned upon on SO. I recommend using the [Mozilla](https://developer.mozilla.org/en-US/docs/Web/Guide/Events/Event_handlers) reference pages instead – happymacarts Jan 22 '18 at 15:47