开发者

Injecting a response value into a textarea to subsequently post

I have multiple notes with class=.note and unique id each inside a div.

On click of edit I grab the id, show hidden form #noteditor and hide all notes.

I am using the load function to get the response (using codeigniter so url does work) and input result in the editorfrorm Textarea id = upnote...

Firebug response looks ok and I have tried to inject into a div and this works fine, BUT getting this injto the text area is causing me some headaches.

There is also the chance that i am going around this a convoluted way due to my limited knowledge...

Any help or pointers v much appreciated...

$(doc开发者_开发知识库ument).ready(function() {

$('.edit').click(function(e){
var v=$(this).attr("id");

$(".note").slideUp();
$("#noteditor").slideDown('1000');

$("#upnote" ).load('/notes/my_note/'+v);




e.preventDefault();
});


To put text in div You use $(thatdiv).html(response) or text(response).

To put stuff in textarea You need to use $(thattextarea).val(response)

So do a get request instead of load and use val() function to put data there in Your callback

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜