Reputation: 13
So i have a div which is text area. Now I want to take the text generated here and store it to a variable. how do i do that in jquery.
this is my code. i want to use a flag to store one value and then later concatenate it to other value and display.
jQuery("#analysis_selectbox").change(function () {
Flag = text_area.val
if (jQuery(this).val() == "1") {
jQuery("#text_area").val(Flag + "success1");
} else {
jQuery("#text_area").val(Flag + "success2");
}
});
});
Upvotes: 0
Views: 60
Reputation: 115242
You need to use
jQuery("#text_area").val()
orjQuery("#text_area")[0].value
, becauseval
is neither a valid jQuery or JavaScript selector
jQuery("#analysis_selectbox").change(function(){
Flag = jQuery("#text_area").val();
if (jQuery(this).val() == "1")
{
jQuery("#text_area").val(Flag + "success1");
}
else {
jQuery("#text_area").val(Flag + "success2");
}
});
Upvotes: 1