views:

85

answers:

3

I am generating user control according to search result. And allowing to change text inside of textarea (picture or video description)

alt text

aaaaaa is default text to change. User can change textarea and when user clicked on EKLE (ADD) button,

i am cloning DIV element that contains image, span, textarea elements and their value. When clicked on EKLE(ADD) button, i am taking EKLE button's parent and appending to result div. But i can't see the textarea content . alt text

// this function is cloning the one result div which is clicked on it and appending the result
function f_ResimSecildi_Ekle(divEklenecek) {

    $(divEklenecek).clone().prependTo("#divEklenenResimler").hide().fadeIn("slow");
    $("#divEklenenResimler input[id*=btnEkleResim_]").remove();
    $("#divEklenenResimler input[id*=btnKaldirResim_]").removeAttr("style").show();
    $("#btnHaberResimleriYap").removeAttr("disabled");        
}

alt text

A: 

You must use .val() method.

jholster
+1  A: 

Well, here is the part where you realize when you clone an input control, the user-data isn't copied as well. Why don't you try using the val() method on the original textarea and setting on the cloned object (again using the val() method!).

themoondothshine
+2  A: 

try this:

function f_ResimSecildi_Ekle(divEklenecek) {
    $(divEklenecek).clone().val(
        $(divEklenecek).val()
    ).prependTo("#divEklenenResimler").hide().fadeIn("slow");
    $("#divEklenenResimler input[id*=btnEkleResim_]").remove();
    $("#divEklenenResimler input[id*=btnKaldirResim_]").removeAttr("style").show();
    $("#btnHaberResimleriYap").removeAttr("disabled");        
}
David Murdoch