I am very new to jQuery so this may be a really stupid question. :-) I'm trying to get something like the following working:
<html>
<head>
<title>JQuery test</title>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1"); // Load jQuery
function DoSomething(link)
{
$(link).after('<div>hello world!</div>');
}
</script>
</head>
<body>
<a href="javascript: DoSomething(this);">Click!</a>
</body>
</html>
Right now that doesn't seem to do anything. But if I change the line to:
$('a').after('<div>hello world!</div>');
Then a DIV does get inserted. However, I want to use an element passed into the function to control where the element gets inserted. Basically, I can't figure out how to start a jQuery query based on an element passed in to a function via the "this" pointer.
Thanks for the help,
~ Justin