I am currently studying a JavaScript source code and it's my first time writing JavaScript. I find some of the syntax confusing.
<script id="source" language="javascript" type="text/javascript">
$(function () {
window.onload=function()
{
mkAjaxObj(0,0);
}
});
</script>
Can you explain why the anonymous function is enclosed in $( ), what is the purpose of $( )? Will the anonymous function be automatically called or executed?
Another question:
var plot = $.plot($("#placeholder"),
[ { data: monkeyavgtime, label: "monkey average run time"}, { data: monkeymixtime, label: "monkey shortest run time" } ],
{
series: {
lines: { show: true },
points: { show: true }
},
grid: { hoverable: true, clickable: true },
yaxis: { min: 0, max: maxtime },
xaxis: {ticks:[[0,version[0]],[1,version[1]],[2,version[2]], [3,version[3]], [4,version[4]],[5,version[5]],[6,version[6]]]}
});
1 : In $.plot, what does the $ stand for?
2 : $("#placeholder")
There is an HTML tag:
Is $("#placeholder") referencing it? Or is there any difference compared to using var obj=document.getElementById("product")?
Thank you very much!