Function calls in JetStrap

158 Views Asked by At

I am trying to use the JetStrap editor to mock up some user interfaces before they are fine tuned and deployed. I'm very new to it, only been using it for a few days.

I put this javascript code in the HTML on a button:

<button onclick="alert("I am an alert box!");">
   Click Me
</button>

When I switch to "Test" mode and click the button, nothing happens.

Is the execution of script prohibited in the Jetstrap editor?

Edit - Adding in some new code for a comment:

HTML:

<button id="thisbutton">
    Click me!
</button>

Code:

$('#thisbutton').click(function() {
  alert('I am an alert box!');
});

That code snippet is the entirety of my "JS" tab.

1

There are 1 best solutions below

2
On BEST ANSWER

Looks like you are using double quotes inside of double quotes, which is why it's not working.

I just tested in Jetstrap it with the single quotes and it's working:

<button onclick="alert('I am an alert box!');">
   Click Me
</button>

However, I would recommend adding an id to the button and then in the Javascript editor doing something like

$('#thisbutton').click(function() {
  alert('I am an alert box!');
});

Which is a better solution as you add more code.