Hi duncan – or someone else of the Sparkle community,
do you know how to execute (trigger) a corresponding “jQuery script” via a button in a Sparkle website (webpage)?
I think I know how to embed jQuery into a Sparkle website (webpage) but I could not find out what to write into the buttons “on-click-external-website-field” to make the button execute the “jQuery script” – although I know how to embed and execute pure javascript via a button.
I hope I was able to clarify my problem and would very much appreciate a “simple” solution – if there is one at all.
thanks for your immediate answer. I’m sure you tested/researched as much as I did and a “10% chance” is definitely not much … But maybe there is someone out there …
Scripts, by their very nature, are usually loaded when the web page loads. This makes any action required by the script available to any element on the page. If your script specifically requires a button click to perform a specific task, then that function will have to be coded into the page somehow. It may be a little more enlightening if we could know what the button click is supposed to do in relation to the script.
Thanks for your replying. I know that scripts are loaded with the page. And of course the script’s function must be encoded into the page – which I have done successfully with Sparkles “embed feature” using javascript, CSS …
I’m looking for the right command to trigger a function in jQuery that needs a buttton, if that is possible at all. As I wrote earlier: It is possible with javascript but i want to know how to use the precoded jQuery scripts.
Yes, I agree. There are limitless functions that are triggered by page elements. This is why I suggest that the code (including its trigger element itself) has to be coded into the page. In the absence of custom attributes, this means creating the button and its onclick event as a peice of code which you enter into your sparkle page through the code embedding option. For example, instead of adding the button to the page and then assigning attributes to it, you will have to add an embed box to the page and place some code that creates the button and its function. Here is a simple example:
<button onclick="myFunction()">Click me</button>
This will create a button with the text “Click me” as its label and when clicked it will execute a function named “myFunction” The function itself will also be defined in the code between script tags.
If you want to style the button, you will have to create inline styling elements between style tags and add that to the code.
I’m sorry for your disappointment. But just to be clear, we are 100% behind the visual nature of Sparkle, if you want a coding environment I think it’s always been crystal clear Sparkle is not it.
Get in touch via email if this is unsatisfactory and you want a refund. We don’t want unhappy customers!
That’s not the point. The point is you can’t take a product in a direction you wish, just because you paid. Sparkle’s direction is very clearly not code-based.
If that wasn’t clear when you purchased Sparkle, my apologies. As mentioned above, an email will fix it.
The point is, that I’m not criticizing Sparkle and I don’t want to take it “in a direction I wish, just because I paid”. And I don’t need and want a refund. I like Sparkle.
What I don’t like is the style you communicate to me in this case – reflect on this, please. All I asked for was: If(!) there is a way to trigger jQuery by Sparkle’s embed feature, please tell me how to do that. If the answer is “no there isn’t a way to do that”, then that’s the way it is. No need to defend “your baby”.
I would just like to add, that I am fully behind a non coding approach and using Sparkle as a visual web design application. I have the greatest respect for the developers and what they have been able to achieve so far with Sparkle’s design ethos. Before Sparkle I used another piece of software to build websites, and my God what a hideous and awful experience it was to build a website etc. Thank You Duncan and Co for designing such a friendly and easy to use visual editor that for the average person is a joy to use.