Hi there...
I want to make a chainable select in MODX.
Here’s what I did.
1. Created a page with a blank template.
2. Dumped the following code into the blank page
3. Ensured that JQuery has the right path (see alert).
4. Ensured the page isn’t cached at all.
Now, regardless of what I do -- the output div never changes.
But, if I copy/paste this code into a testy.php file and dump it into the modx root the script works.
So why is MODX not running the Jquery?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Title</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<script type="text/javascript" src="jquery-1.3.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
alert("READY!");
$("#developer").change(onSelectChange);
});
function onSelectChange()
{alert("In here");
var selected = $("#developer option:selected");
var output = "";
if(selected.val() != 0){
output = "You Selected " + selected.text();
}
$("#output").html(output);
}
</script>
</head>
<body>
<h3>Developers</h3>
<select id="developer">
<option value="0">Select Developer</option>
<option value="1">Todd Sharp</option>
<option value="2">Brian Meloche</option>
<option value="3">Ray Camden</option>
<option value="4">Sean Corfield</option>
<option value="5">Ben Nadel</option>
<option value="6">Mark Drew</option>
<option value="7">Rey Bango</option>
<option value="8">Mark Mandel</option>
<option value="9">Joe Rinehart</option>
<option value="10">Dan Vega</option>
</select>
<br /><br />
<div id="output"></div>
</body>
</html>