Is it $.get() - asynchronous call? Maybe you try to fill textarea Before str1 get its data?
I think you should filll textarea from Success event rather than after $.get call... On Jan 9, 2008 6:43 AM, Jeffrey Kretz <[EMAIL PROTECTED]> wrote: > > It might be worth a shot to try jQuery functions rather than native > functions. Something like this: > > $(document).ready(function() { > $("a").click(function() { > var coursename = $(this).attr('coursename'); > var mydata = $.get("http://localhost:8080/course/" + coursename + > "/", {}, function(mydata) { > return mydata; > }); > var str1 = mydata.responseText.substring(5,7); > var textAreaNode=$('#test'); > textAreaNode.val(textAreaNode.val + str1); > return false; > }); > }); > -----Original Message----- > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of knairb01 > Sent: Tuesday, January 08, 2008 7:03 PM > To: jQuery (English) > Subject: [jQuery] can only modify DOM via debugger > > > Hi > > I've got a problem. I'm running Firefox 2.0.0.11, Firebug 1.0, jQuery > 1.2.1. I have the following code in a Genshi template for a toy > TurboGears 2.0 app: > > > $(document).ready(function() { > $("a").click(function() { > var coursename = $(this)[0].attributes['coursename'].nodeValue; > var mydata = $.get("http://localhost:8080/course/" + coursename + > "/", {}, function(mydata) { > return mydata; > }); > var str1 = mydata.responseText.substring(5,7); > var textAreaNode=document.getElementById('test'); > textAreaNode.value += str1; > return false; > }); > }); > > > When the user clicks a link, the code above attempts to put text in > the textarea. When I step through the code with Firebug, it works, but > it doesn't when I run it without the debugger. Also, the code will > work when I run it straight through if str1 is a hard-coded string; > such as if the line is "var str1 = "my string";". > > Thank you for any help you can give. > >