Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/444.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript jquery双线中断_Javascript_Jquery - Fatal编程技术网

Javascript jquery双线中断

Javascript jquery双线中断,javascript,jquery,Javascript,Jquery,我有一个函数,可以从对话框中包含的两个TextArea输入中读取文本,并在单击“保存”按钮后将它们插入到多行asp文本框中 我想要的是变量sReason和sParents中的文本在它们之间出现两个空行。。即: text from sReason text from sParents 以下是我的jquery函数的代码: <script type="text/javascript"> $(function() { $("#DiagSituation").dialo

我有一个函数,可以从对话框中包含的两个TextArea输入中读取文本,并在单击“保存”按钮后将它们插入到多行asp文本框中

我想要的是变量sReason和sParents中的文本在它们之间出现两个空行。。即:

text from sReason


text from sParents
以下是我的jquery函数的代码:

<script type="text/javascript">
    $(function() {

    $("#DiagSituation").dialog({
            autoOpen: false,
            height: 300,
            width: 350,
            modal: true,
            buttons: {
            "Save": function() {

            var sReason = "The reason I am informing/referring to you is " + $('#SitReason').val()
            var sParents = "Parent/s presented " + $('#SitParents').val()

                $('#txbRefConcern').val(sReason + " " + sParents);
                    $(this).dialog("close");
                },
                "Cancel": function() {
                    $(this).dialog("close");
                }
            },
            close: function() {
                $('#SitReason').val("");
                $('#SitParents').val("");
            }
        });

        var txbRefCon = $("#txbRefConcern").val();
        if (jQuery.trim(txbRefCon).length == 0)    
            {
                $("#txbRefConcern").click(function() { $("#DiagSituation").dialog("open"); });
            }
    });
    </script>

$(函数(){
$(“#诊断情况”)。对话框({
自动打开:错误,
身高:300,
宽度:350,
莫代尔:是的,
按钮:{
“保存”:函数(){
var sReason=“我通知/提及您的原因是”+$('#SitReason').val()
var sParents=“呈现的父项”+$('#SitParents').val()
$('#txbRefConcern').val(sReason+“”+sParents);
$(此).dialog(“关闭”);
},
“取消”:函数(){
$(此).dialog(“关闭”);
}
},
关闭:函数(){
$('#SitReason').val(“”);
$('#SitParents').val(“”);
}
});
var txbRefCon=$(“#txbrefconn”).val();
if(jQuery.trim(txbRefCon).length==0)
{
$(“#TXBREFCONNECT”)。单击(函数(){$(“#诊断情况”)。对话框(“打开”);};
}
});
我已经尝试过编辑
$('#txbRefConcern').val(sReason+“”+sParents)代码行并在引号中添加\但这不起作用。如何获得额外的换行符?我还不熟悉jquery/javascript的编码,因此一些示例代码可能会有所帮助

谢谢你的帮助


Rob

我想你的意思是:

$('#txbRefConcern').val(sReason + "\n\n\n" + sParents);

\n是换行符,\r是windows变体,如果im正确(表示回车)

谢谢!这就是我在
\r\n
组合也起作用后所做的。我在不久前做JS项目时使用了这个: