Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/84.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 如何更改每个段落周围的边框<;p>;从下拉列表中动态选择节?_Javascript_Jquery_Html_Css_Textarea - Fatal编程技术网

Javascript 如何更改每个段落周围的边框<;p>;从下拉列表中动态选择节?

Javascript 如何更改每个段落周围的边框<;p>;从下拉列表中动态选择节?,javascript,jquery,html,css,textarea,Javascript,Jquery,Html,Css,Textarea,以下随附的提琴允许文本粘贴到中,并在单击按钮时转换为段落 是否可以在FIDLE中创建一个下拉列表,其中可以围绕每个段落部分创建边框,并根据用户的选择从下拉列表动态更新到其他边框 如果一个更新的小提琴可以提供将非常感谢,因为我仍然是新的编码 谢谢大家! HTML: xzxz 去 JavaScript: $(function () { $('button').on('click', function () { var theText = $('textare

以下随附的提琴允许文本粘贴到
中,并在单击按钮时转换为段落


是否可以在FIDLE中创建一个下拉列表
,其中可以围绕每个段落部分创建边框,并根据用户的选择从下拉列表动态更新到其他边框

如果一个更新的小提琴可以提供将非常感谢,因为我仍然是新的编码

谢谢大家!

HTML:


xzxz
去

JavaScript:

    $(function () {
    $('button').on('click', function () {
        var theText = $('textarea').val();
        var i = 200;
        while (theText.length > 200) {
            console.log('looping');
            while (theText.charAt(i) !== '.') {
                i++;   
            }

            console.log(i);
            $("#text_land").append("<p>" + theText.substring(0, i+1) + "</p>");
            theText = theText.substring(i+1);
            i = 200;
        }

        $('#text_land').append("<p>" + theText + "</p>");
    });

});
$(函数(){
$('button')。在('click',函数(){
var theText=$('textarea').val();
var i=200;
而(文本长度>200){
console.log(“循环”);
while(text.charAt(i)!='.')){
i++;
}
控制台日志(i);
$(“#text_land”)。追加(“”+文本子字符串(0,i+1)+“

”); theText=theText.substring(i+1); i=200; } $('text'u land')。追加(“”+文本+”

”; }); });
$(函数(){
$('button')。在('click',函数(){
var theText=$('textarea').val();
var i=200;
而(文本长度>200){
console.log(“循环”);
while(text.charAt(i)!='.')){
i++;
}
控制台日志(i);
$(“#text_land”).append(“

”+文本子字符串(0,i+1)+“

”); theText=theText.substring(i+1); i=200; } $(“#text_land”)。追加(“

”+文本+”

”; }) $('#borders')。on('change',function(){ var border=$(this.val(); $('[target=“tobeordered”]')。每个(函数(idx、obj){ $(obj).removeClass('虚线'); $(obj).addClass(边框); }); }); });
。虚线{
边框:1px虚线#000
}
.点点{
边框:1件带点的#000
}

xzxz


冲刺 星罗棋布的
类似的问题?@Rajesh-堆栈溢出问题与此问题不同。这个问题的目的是在段落周围启用边框,而另一个问题是更改段落元素的颜色和文本大小。@Dave answers在上一篇文章中介绍了如何更新标记的css属性,该属性甚至适用于边框。请自己试一试,如果你遇到困难,那就去问吧。不要问类似的问题questions@Rajesh-谢谢你的信息!。
    $(function () {
    $('button').on('click', function () {
        var theText = $('textarea').val();
        var i = 200;
        while (theText.length > 200) {
            console.log('looping');
            while (theText.charAt(i) !== '.') {
                i++;   
            }

            console.log(i);
            $("#text_land").append("<p>" + theText.substring(0, i+1) + "</p>");
            theText = theText.substring(i+1);
            i = 200;
        }

        $('#text_land').append("<p>" + theText + "</p>");
    });

});