//1.用单双引号拼接 var valueDemo = "111"; var htmlStrs1 = ‘<option selected="selected" value="‘+valueDemo+‘"></option>‘; alert(htmlStrs1); //2.通过转义字符拼接 var htmlStrs2 = "<option selected=\"selected\" value=\""+valueDemo+"\">"+valueDemo+"</option>"; alert(htmlStrs2); //3.通过Jqquery直接创建标签对象 $("<option></option>")
原文地址:https://www.cnblogs.com/damoblog/p/9456468.html
时间: 2024-10-06 21:43:54