I need to have a 'Click to Accept Terms' checkbox on my site (http://www.formulafast.co.uk/book-now.html), that enables a link to another page when checked.
So far I have adapted a script and html that has worked successfully (elsewhere on the internet) and works fine in JS fiddle (see http://jsfiddle.net/pjs53/hQJXW/104/) but as soon as I paste onto my page fails to work.
HTML is:
<input type="checkbox" id="check"/><label for="check">I have read and accept the Terms & Conditions</label></br></br>
The Javascript is in the jsfiddle above.
Worth mentioning that I'm using Weebly...and the html part is currently embedded as a snippet halfway down the page. The javascript is in the header section of this particular page. If anyone has a better suggestion please don't be shy.
I have a feeling it may be the placement of the code that may be causing it not to work, or I am missing a tag to link the two together...any ideas?
Reading the comments above, you actually forgot to include jQuery in your html, like this :
<script src="path_to_jquery_file"></script>
Your JSFiddle is using jQuery as a framework (look on the left), that's why it works but not your web page.
Related
I followed advice from this site on how to embed
the code that i found on how to recreate the
Animated Sign In Form … shown here:
https://youtu.be/5uANWpkuPww
I was hoping to modify it, so that one face of the
animated circle contained text inviting people to
subscribe to my mailing list … with the clickable
link causing the circle to rotate, allowing people
to then enter their name and email address.
In any case, I got the code from:
https://github.com/DaftCreation/Animated-Sign-In---Sign-Up-Form
and tried it out on w3schools.com
Here is the result:
https://www.w3schools.com/code/tryit.asp?filename=G15FD7XT1JF6
If anybody will be kind enough to get it to work,
please save it on w3schools.com … and post the link / URL
here on stackoverflow.com
I am guessing that the guy that created it, may have left out
a character or two, when he cut and pasted it, which has
resulting in the code not working correctly ... and be sure to
let me know what was wrong with it, so that i can learn from this.
Thanks : )
Your code is fine - the only real problem with is that you didn't wrap your jQuery in between <script></script> tags. Use the link below and you can see it working.
https://www.w3schools.com/code/tryit.asp?filename=G15LTVZCBB4R
Also you need to make sure your jQuery link is valid (just copy and paste the one from my code - it is via Google CDN).
I am alien to javascript so pardon me for any naive mistake you find (though that's what I am looking for).
I tried to replicate the code provided for testing the button click event for plotly, but it's not getting fired.
Link from which code is imported:
https://plot.ly/javascript/custom-buttons/#bind-button-events-to-plotlyjs-charts
The way I used it in my html file to test it is shown in the image attached. It works well in code snippet, but due to some mistake of mine in using the javascript in the same page, I am not able to get in work.
Assistance highly appreciated.
the cdn link to jquery wasn't working.
Never rely on the external, keep a local copy of all libraries and call them
I'm currently working on a web editor where you can enter your HTML, CSS and JavaScript code and see the result in real time. Something similar to JSBin or JSFiddle. (I'm doing that to get an offline editor)
I've already been through many problems especially when it comes to CSS but I solved them by using an iframe and injecting all my code into it. And that works amazingly well until you type some JavaScript.
I'm sending the code between <script></script> but unlike CSS it won't run. What's very weird is that when I enter something like $('button').css('color', 'red');, the buttons of the editor effectively get affected but not those of my iframe. Exactly the opposite of what I expected. I've tried many things, looked at many topics on the forum, but nothing works. I also tried to load a blank page in my iframe. In that case, JavaScript runs but it becomes impossible to edit the code in the iframe! What's going on? Where am I going wrong? Thank you in advance for your help!
Here's my editor : https://jsbin.com/tuqite/edit?html,js,output/
Try updating the content of the iframe like this.
// this string contains both html and script
var html_string= "content";
document.getElementById('childFrame').src = "data:text/html;charset=utf-8," + escape(html_string);
By directly updating the iframe DOM like the way you are doing may not be the right way .
I have a button on my cover page and I need to assign to it 1 line of javascript code (namely javascript:languageClicked(0); to work with this neat addon: Multilingualizer) .
So the button should execute that line of code and do its usual job, namely to send the user to my main webpage.
thx in advance
Is the languageClicked function code from Multilingualizer? If so, maybe that addon isn't enabled correctly on your page or something and the js files for it are not being loaded.
But, once they are loaded. You can replace your button with this code:
ENTER
Screenshot
Since you want the user to be redirected to /expnew after activating languageClicked.
Hope this helps! Also, there is one catch though; don't change this unless you know for sure you have those JS libraries loaded. ^_^
Without some HTML snippets and the name of the button you are working with, it is hard to know exactly how to help. However, I can share some general knowledge that may provide the answer for you.
The two most common ways that JavaScript triggers are implemented are:
1. <a> "link buttons":
Your code might look something like:
Click me!
2. <input>/<button>/any element onclick events:
Your code might look something like:
<button onclick="javascript:languageClicked(0)">Click me!</button>
I have a blog hosted freely on blogger. I want to show some html live demo, as my tutorial is about javascript and html. Can anyone suggest, how it can be done, i have to display sample javascipt page based on Extjs.
It should be embedded inside the post, like how we paste the code using code syntax highlighter.
Something similar to this demo: http://docs.sencha.com/touch/2-0/#!/api/Ext.form.Panel
Edit-1
As per #Circadian, i have used jsFiddle.net but it is giving entire code too, as shown in the image attached. But I don't want to share my entire code. Any other better suggestions? .
Thanks in advance.
jsfiddle offers iframe embedding and supports Extjs
edit:
then have a look at using github gists