1

I created one multi line text box.In that text box every time some remarks should be added with the different users. But existing content would not change or delete. The new text should add with that text box.

I tried the many ways to do this. But i can't find any one idea. People please help me to fix this issue.

<%: Html.TextArea("Remark", Model.Remarks, new { @maxlength = "400" })%>
1
  • pls see edited answer - with read-only and line breaks Commented Sep 4, 2015 at 11:35

1 Answer 1

2

This is just an example. Its better to have an input below the text area to get the text from to append and then clear it once appended, but you get the gist. It requires jquery.

(function($){
    $.fn.extend({
        valAppend: function(text){
            return this.each(function(i,e){
                var $i =$('#remark')
                var $e = $('#comment');
                $i.val($i.val()  +'\n'  + $e.val());
            });
        }
    });
})(jQuery);


$('#append').click(function(){
    $('textarea').valAppend();
    $('#comment').val('');
    $('textarea').attr('readonly','readonly');
});
textarea, input{display:block;}
#remark{height:100px; width:200px;border: 1px solid black}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<textarea id="remark"></textarea>
<input type="text" id="comment" placeholder ="enter commment"></input>
<input type="button" id="append" value="append" />

Sign up to request clarification or add additional context in comments.

2 Comments

But existing content should show. but it should be hidden. not editable. they can add new content. while saving data all those things will be add.
ah i missed that .. i'll have another fiddle

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.