I’ve created links to transition yet when the function is supposed to be called using the onmousedown event I get an uncaught undefined function. Clearly my function is defined. I’m am still learning code so what is it I don’t see or understand. Any tips will be greatly appreciated.
<html>
<head>
<script type="text/javascript"src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery-ui.js"></script>
<script type="javascript">
$(document).ready(function (){
var url = "phpajaxtut.php";
});
function swapContent(cv){
$("#myDiv").html("animated gif goes here").show();
.post(url, {contentVar:cv}, function(data){
$("#myDiv").html(data).show();
});
}
</script>
<a href="#" onClick="return false" onmousedown="swapContent('con1')">Click the text</a>
<a href="#" onClick="return false" onmousedown="swapContent('con2');">Click the text</a>
<a href="#" onClick="return false" onmousedown="swapContent('con3');">Click the text</a>
</head>
<body >
<div id ="myDiv">My default content</div>
</body>
</html>
Why not just use
$.click();instead, since you’re already using jQuery, and forgo the hyperlinks? You can easily style some spans to look likeas if that’s what you want. My example just updates some text, but in there you can place / call your function.See here: