//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>")
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/17192.html