so simple question! How can I pass a variable into a jQuery function, like in Javascript?
<script type="text/javascript">
function foo(bar) {
$("#content").load(bar);
}
</script>
<a href="#" onClick="foo('test.php');">Load</a>
The above code doesn’t work, clearly, but hopefully you can get an idea for what I’m asking.
You are programming in JavaScript.
jQuery is just a library – a bunch of JavaScript functions you can use; it is not another language.
That said, a more modern way of achieving your goal is to use jQuery for event binding
.
Working example: http://jsfiddle.net/wtL88/