Linking to jquery and javascript is not working -
in coda 2, can link css when link lot of stuff doesn't work because nothing happens, jquery. wrong this? btw here far in jsbin if matters
main.html
<!doctype html> <html> <head> <link rel="stylesheet" type="text/css" href="planets.css"> <script src="planets.js"></script> <script src="http://code.jquery.com/jquery-2.0.3.min.js"></script> <title>planets</title> </head>
planets.js:
$('#submit').click(function () { var checkedplanet = $("input[name='planets']:checked").val(); $("input:radio").attr("checked", false); var age = document.getelementbyid('age').value; var newage; if(checkedplanet==='mercury'){ newage = math.round(age/0.241); alert("you be"+" "+newage+" "+ "years old on mercury!"); } if(checkedplanet==='venus'){ newage = math.round(age/0.615); alert("you be"+" "+newage+" "+ "years old on venus!"); } if(checkedplanet==='earth'){ alert('you be'+" "+ age*1+" " +'on earth! duh!'); } if(checkedplanet==='mars'){ newage=math.round(age/1.88); alert("you be"+" "+newage+" "+ "years old on mars!"); } if(checkedplanet==='jupiter'){} });
what quentin said code example:
<script src="//code.jquery.com/jquery-2.0.3.min.js"></script> <!-- lose http:, , jquery load on https --> <script src="planets.js"></script> //wait until dom ready $(function(){ //your code });
Comments
Post a Comment