You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import Stipple
import StippleUI
import Genie
@Stipple.vars reactives begin
name::String = "World!"
end
Stipple.Layout.add_script("https://cdn.jsdelivr.net/npm/sweetalert2@11")
############ javascript code (PROBLEM) ############
lib_module() = [
Stipple.script(type ="module", "
// script code goes here
document.getElementsByClassName('btn1')[0].addEventListener('click', function() {
Swal.fire({title: 'Stipple Fire!'})
})
")
]
@Stipple.deps lib_module
############ javascript code (PROBLEM) ############
function ui()
finalMatch = """
<button class="btn1">Click me!</button>
<q-input v-model="name"/>
<p>Typed text: {{ name }}</p>
"""
return finalMatch
end
Stipple.route("/") do
Stipple.page(
Stipple.init(reactives),
ui()
) |> Stipple.html
end
Stipple.up()
But Sweet Alert's javascript doesn't work. I don't know what I did wrong, I followed the steps in the documentation, but I don't think I did something right.
I could do it like this, with onclick in the button tag:
I have this code in Stipple:
But Sweet Alert's javascript doesn't work. I don't know what I did wrong, I followed the steps in the documentation, but I don't think I did something right.
I could do it like this, with onclick in the button tag:
But I would like to access the script normally.
The text was updated successfully, but these errors were encountered: