JQuery Sandbox
From Wikicliki
Revision as of 14:09, 20 August 2008 by 85.8.189.160 (talk)
experiment one
this experiment prints the contents of the textarea in an alert, and also prints the tagname of the clicked items into the first span tag available....
<html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("a").click(function(){ var curText= $("#myText").val(); var urlname = curText; alert(urlname); }); $("*", document.body).click(function (e) { e.stopPropagation(); var getthething = $(this).get(0); $("span:first").text("Clicked on - " + getthething.tagName); }); }); </script> </head> <body> <a name="namename" id="idname" href="index2.html"> non nummy bong bong</a> <br><br> <span class=first></span> <br><br> <textarea name="myText" rows="5" cols="20" id="myText" style="width:250px;"></textarea> </body> </html>