jquery获取元素 元素的id是变量

点击按钮后 。只生成了div ,span没有

        $("button").click(function(){
            var math1=Math.random();
            $("<div></div>").attr('id',math1).css({'width':'200px','height':'200px','position':'absolute','backgroundColor':'#666','float':'left','left':'500px'}).appendTo('body')
            var math2=Math.random()
            $("<span></span>").attr('id',math2).css({'width':'200px','height':'30px','backgroundColor':'red','display':'inline-block'}).appendTo($('#'+math1))  

Math.random得到小数包含.,.是类选择器鸟

 $("button").click(function () {
        var math1 = Math.random().toString().replace('.','_');////////////////////////