NetTalk Central

Author Topic: Button on header  (Read 2173 times)

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 444
    • View Profile
    • Email
Button on header
« on: March 14, 2025, 01:15:42 AM »
Hi
I'm trying to place a button on the header on a form.
Allow xHTML is on
Allow UNSAFE xHTML is on
I can place a button without any problems but when I add the attribute onclick="onclick="$(''.help-click'').click()"" it fails. Does it have anything to do with the fact that "onclick" is SUPER UNSAFE?

Example attached.

Regards Niels

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11296
    • View Profile
Re: Button on header
« Reply #1 on: March 18, 2025, 02:30:25 AM »
I had no success try to make this work. I recommend an alternative approach - like setting a data- attribute on the button then attaching JavaScript to that attribute in your custom javascript file.

Niels Larsen

  • Sr. Member
  • ****
  • Posts: 444
    • View Profile
    • Email
Re: Button on header
« Reply #2 on: March 18, 2025, 10:53:22 PM »
Thanks Bruce,
 it works fine when I add the code in the console

$('.help-button').click(function(){
    alert($(this).attr('data-button'));
});

But I'm very unsure where to insert my script.
I've tried all sorts of places. In the index page, in the header, but nothing really comes through or it lands in the wrong place.
Can you guide me in the right direction?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11296
    • View Profile
Re: Button on header
« Reply #3 on: March 24, 2025, 10:09:05 PM »
not really. I had no success making this work.