View Full Version : linking js to php?

02-24-2012, 05:55 PM
Hi all,

I'm trying to link a java script file to a html file but it's not working.
Any ideas?


<head><script type="text/javascript" src="newjavascript.js"></script></head>
<body> <div id="myRadioGroup">

2 Cars<input type="radio" name="cars" checked="checked" value="twoCarDiv" />

3 Cars<input type="radio" name="cars" value="threeCarDiv" />

<div id="twoCarDiv" class="desc">
2 Cars Selected
<div id="threeCarDiv" class="desc">
3 Cars


$("input[name='cars']").click(function() {

var test = $(this).val();

Old Pedant
02-24-2012, 10:29 PM
And where, pray tell, is there any PHP involved, in any way???

Anyway... You are using jQuery code, not basic JavaScript, so you have to *ALSO* link in a jQuery library.

02-26-2012, 02:30 PM
the coding is mostly php apart from this one page, i should have said html instead. What's a JQuery library?