无法将连续值附加到div块中的customId [英] Unable to append concatenated value to a customId in a div block

查看:249
本文介绍了无法将连续值附加到div块中的customId的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是无法添加合并的内容到div块的customId。 Follwing是代码。

The problem is im unable to add the merged content to the div block for a customId. Follwing is the code.

     var selectedTemplate;

        var selectedAssignment;

        var mergeValue;

        var divContent = "<div id='" + criterion.id + "' customId='" + mergeValue + "'                style='font-weight:bold; font-style:italic;'>" + criterion.expression + "&nbsp;&nbsp;&nbsp;&nbsp;" +
                      </div>\n";


    selectedTemplate   = $("#criteriaTemplate option:selected").val(); // 1st dropdown value
    selectedAssignment = $("#criteriaOptions option:selected" ).val(); // 2nd dropdown value

     mergeValue = selectedTemplate + selectedAssignment;

我试图将合并内容附加到一个块中的customID,但在浏览器中,当我检查 InspectElement 它显示如下

and i am trying to append the merge content to customID in a block but in the browser when i check InspectElement it is showing as follows

    <div id="8a808088442eb48001442efe70f20010" customid="undefined" style="font-weight:bold; font-style:italic;">some Text here &nbsp;&nbsp;&nbsp;&nbsp;</div>

建议我一些解决方案

推荐答案

完整的代码是:

    var selectedTemplate;            
    var selectedAssignment;            
    var mergeValue;                     

    selectedTemplate   = $("#criteriaTemplate option:selected").val(); // 1st dropdown value
    selectedAssignment = $("#criteriaOptions option:selected" ).val(); 

    mergeValue = selectedTemplate + selectedAssignment;      

    var divContent = "<div id='" + criterion.id + "' customId='" + mergeValue + "'                style='font-weight:bold; font-style:italic;'>" + criterion.expression + "&nbsp;&nbsp;&nbsp;&nbsp;" +
                              </div>\n";

这篇关于无法将连续值附加到div块中的customId的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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