JQuery点击收起,点击展开以及部分非空小验证

                         <tr>
                                            <td nowrap align="right" width="18%">
                                                解决方案:
                                            </td>
                                            <td width="35%">
                                                <a href="#" id="btnShow">
                                                    <%--点击添加--%>
                                                    <img id="imgShow" style=" 50px; height: 50px" src="../images/add.jpg" />
                                                </a>
                                                <script type="text/javascript">
                                                    $("#btnShow").click(
                                                        function () {
                                                            if ($("#scheme").css("display") == "none") {
                                                                $("#imgShow").attr("src", "../images/pack.jpg");
                                                            }
                                                            else if ($("#scheme").css("display") == "table-row") {
                                                                $("#imgShow").attr("src", "../images/add.jpg");
                                                            }
                                                            $("#scheme").fadeToggle(1000);
                                                        }
                                                     );
                                                </script>
                                            </td>
                                        </tr>
                                        <tr id="scheme" style="display: none">
                                            <td width="15%" nowrap align="right">
                                                解决内容:
                                            </td>
                                            <td colspan="3">
                                                <input runat="server" type="hidden" id="txtSContent" />
                                                <%--<script id="Scontainer" style=" 600px; height: 200px" type="text/plain"></script>--%>
                                                <textarea runat="server" id="Scontainer" style=" 600px; height: 200px" type="text/plain"></textarea>
                                                <script type="text/javascript">
                                                    var ue = UE.getEditor('Scontainer');

                                                    function getContent() {
                                                        var editor = UE.getEditor("Scontainer").getContent(); //得到编辑器
                                                        //document.getElementById("txtSContent").value = editor;
                                                    }
                                                </script>
                                            </td>
                                        </tr>

非空验证:

 var name = $('#txtName').val();
                                        name = $.trim(name);
                                        if (name.length < 1) {
                                            alert("问题名称不为空");
                                        }

                                        var scontent = $('#txtSContent').val();
                                        scontent = $.trim(scontent);
                                        if (scontent.length < 1) {
                                            alert("解决内容不为空");
                                        }

                                        var qcontent = $('#txtQContent').val();
                                        qcontent = $.trim(qcontent);
                                        if (qcontent.length < 1) {
                                            alert("问题内容不为空");
                                        }
原文地址:https://www.cnblogs.com/llcdbk/p/4322888.html