How to create div with class

后端 未结 5 454
感情败类
感情败类 2021-02-02 07:15

I\'m trying to create a div and give him a class but it doesn\'t work. Could anybody help me?

$(document).ready(function() {
$(\'input[type=checkbox]\').each(fun         


        
5条回答
  •  一整个雨季
    2021-02-02 07:29

    $(document).ready(function() {
    $('input[type=checkbox]').each(function() {
        $(this).after($('
    ', { class: 'test', text: "a div", click: function(e){ e.preventDefault(); alert("test") }})); }); });

    http://jsfiddle.net/yF9pA/1/

提交回复
热议问题