如何以Html格式仅打印完整文本区域 [英] How Do I Print Only Full Textarea In Html Form

查看:314
本文介绍了如何以Html格式仅打印完整文本区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多textarea如何将它们发送到打印但只有完整的一个如果我有一个空的他不打印他





感谢您的帮助

解决方案

您可以尝试结合使用css和javascript来获得所需的效果。

< pre lang =css> / * for print css - 如果它有一个空的* *,则不显示textarea
@ media print {
textarea empty {显示 无; }
}



  //  测试textarea是否有v alue,在页面启动和onblur期间,如果它是空的,则将空类添加到textarea  


document ).ready( function (){


' < span class =code-string> textarea')。each( function (i,e){
if (!


i got many textarea how do i send them to print but only the full one if i got an empty one he doesn't print him


thanks for the help

解决方案

You could try using css and javascript in conjunction to get your desired effect.

/*for print css - do not display textarea if it has a class of empty*/
@media print {
    textarea.empty{display:none;}
}


//test if textarea has value, during page start-up and onblur, add empty class to textarea if it is empty


(document).ready(function (){


('textarea').each(function (i, e) { if (!


这篇关于如何以Html格式仅打印完整文本区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆