jQuery append not working in IE8

前端 未结 5 1300
说谎
说谎 2021-01-12 06:16
 $(\'#buttonadd\').click(function(){
            if ($counter < 10)
            {
                $counter++;
                $countonlyadd++;
                $(\         


        
5条回答
  •  囚心锁ツ
    2021-01-12 07:14

    Looks like you are adding a tr directly into which is not a valid html in any browser. Other browsers will not shout but IE will. Try this.

    Working demo

    Markup change

    JS change

    $('#buttonadd').click(function(){
                if ($counter < 10)
                {
                    $counter++;
                    $countonlyadd++;
                    $('#buttondiv table').append(' [X]');
                }else{
                }
                $('#send_count').val($countonlyadd);
            });
    

提交回复
热议问题