Print when textarea has overflow

前端 未结 11 975
眼角桃花
眼角桃花 2020-12-04 23:59

I have a form with some text areas that allow a scroll bar when the text exceeds the text box. The user would like to be able to print the screen, and this text is not visib

11条回答
  •  醉话见心
    2020-12-05 00:31

    With the usage of pure CSS it is not possible to prepare the textarea for printing.

    It is necessary to add some javacript magic to the text area or add a hidden field.

    There are a couple of solutions, that have been mentioned here:

    1. Hidden paragraph or div
    2. Using Javascript to extent the size of the textarea

    1. Hidden paragraph or div

    HTML & CSS:

    
    
    Sample Text

    2. Javascript

    You could use a js library e.g https://github.com/thomasjo/jquery-autoresize

    $(function() {
        $("textarea").autoResize()
    })
    

提交回复
热议问题