<bdo id='BJCoT'></bdo><ul id='BJCoT'></ul>
<tfoot id='BJCoT'></tfoot>

      <legend id='BJCoT'><style id='BJCoT'><dir id='BJCoT'><q id='BJCoT'></q></dir></style></legend>
    1. <small id='BJCoT'></small><noframes id='BJCoT'>

      <i id='BJCoT'><tr id='BJCoT'><dt id='BJCoT'><q id='BJCoT'><span id='BJCoT'><b id='BJCoT'><form id='BJCoT'><ins id='BJCoT'></ins><ul id='BJCoT'></ul><sub id='BJCoT'></sub></form><legend id='BJCoT'></legend><bdo id='BJCoT'><pre id='BJCoT'><center id='BJCoT'></center></pre></bdo></b><th id='BJCoT'></th></span></q></dt></tr></i><div id='BJCoT'><tfoot id='BJCoT'></tfoot><dl id='BJCoT'><fieldset id='BJCoT'></fieldset></dl></div>
      1. 向表单添加字段(jQuery)

        Adding a field to a form (jQuery)(向表单添加字段(jQuery))

          • <bdo id='d6WK3'></bdo><ul id='d6WK3'></ul>
            <legend id='d6WK3'><style id='d6WK3'><dir id='d6WK3'><q id='d6WK3'></q></dir></style></legend>
          • <tfoot id='d6WK3'></tfoot>

            <small id='d6WK3'></small><noframes id='d6WK3'>

                  <i id='d6WK3'><tr id='d6WK3'><dt id='d6WK3'><q id='d6WK3'><span id='d6WK3'><b id='d6WK3'><form id='d6WK3'><ins id='d6WK3'></ins><ul id='d6WK3'></ul><sub id='d6WK3'></sub></form><legend id='d6WK3'></legend><bdo id='d6WK3'><pre id='d6WK3'><center id='d6WK3'></center></pre></bdo></b><th id='d6WK3'></th></span></q></dt></tr></i><div id='d6WK3'><tfoot id='d6WK3'></tfoot><dl id='d6WK3'><fieldset id='d6WK3'></fieldset></dl></div>

                    <tbody id='d6WK3'></tbody>
                  本文介绍了向表单添加字段(jQuery)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  I'm constructing a form. No problem there. Aside of a submit button, I have another button that, when clicked, adds another field to the form. I am attempting to use javascript (jquery) to do this. Needless to say I am not having any luck. I have tried many different methods, and this is the one I gave up at:

                  $("#snew").click(function () {  
                  var container = $("#sblc").add("div");
                  var content = "<select> <option>Domestic</option><option>Tiger</option><option>Peeled                  Raw</option><option>Cooked Peeled Tail On<option></select><select> <option>1 lbs</option>   <option>2 lbs</option><option>3 lbs</option></select>";
                  
                                  $(container).attr("class", "opt");
                                  $(container).append(content); 
                                  $(container).appendTo("#sblc"); 
                  
                              })
                  

                  Here is the HTML that corresponds: http://pastie.org/3729304 (I couldn't figure out how to get the HTML to display properly on here. Sorry for the link. )

                  Whenever I try this, I end up either getting a completely white page, or nothing happens at all. Any help would be greatly appreciated.

                  解决方案

                  Try something like below,

                  DEMO

                  $("#snew").click(function() {
                      var container = $("<div />");
                      var content = "<select> <option>Domestic</option><option>Tiger</option><option>Peeled                  Raw</option><option>Cooked Peeled Tail On<option></select><select> <option>1 lbs</option>   <option>2 lbs</option><option>3 lbs</option></select>";
                  
                      $(container)
                          .attr("class", "opt") //add class to the div container
                          .append(content)      //append select to the div
                          .appendTo("#sblc");   //append div to #sblc
                  
                  });
                  

                  这篇关于向表单添加字段(jQuery)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  append() 方法在被选元素的结尾(仍然在内部)插入指定内容。 语法: $(selector).append( content ) var creatPrintList = function(data){ var innerHtml = ""; for(var i =0;i data.length;i++){ innerHtml +="li class='contentLi'"; innerHtml +="a href
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)

                      <bdo id='v72LY'></bdo><ul id='v72LY'></ul>
                      <i id='v72LY'><tr id='v72LY'><dt id='v72LY'><q id='v72LY'><span id='v72LY'><b id='v72LY'><form id='v72LY'><ins id='v72LY'></ins><ul id='v72LY'></ul><sub id='v72LY'></sub></form><legend id='v72LY'></legend><bdo id='v72LY'><pre id='v72LY'><center id='v72LY'></center></pre></bdo></b><th id='v72LY'></th></span></q></dt></tr></i><div id='v72LY'><tfoot id='v72LY'></tfoot><dl id='v72LY'><fieldset id='v72LY'></fieldset></dl></div>

                      <small id='v72LY'></small><noframes id='v72LY'>

                    • <legend id='v72LY'><style id='v72LY'><dir id='v72LY'><q id='v72LY'></q></dir></style></legend>
                          1. <tfoot id='v72LY'></tfoot>
                              <tbody id='v72LY'></tbody>