Q: table td is not taking its css when created dynamically var $imageicon = $('<image/>');
 $imageicon.attr('src', '../../Content/images/ReplyIcon.png');
 $imageicon.addClass('replyIcon');
 var $table = $('<table/>').addClass('replyContent');
 $table.attr('id', 'replyArea');
                
 $table.append(
                         $('<tr>').append($('<td>').append($imageicon).addClass('replyIcontd'), $('<td>').text('hii'))
      );
 $("#container").append(
               $('<div/>')
                  .attr('id', 'replytopost')
                  .append($table)
            );

css
.replyIcontd
{
   width:5%;
   
}

table is showing up but i waent to reduce space between hii and image I am trying to reduce the width to 5% but I am unable to do it
I the image hii is one td and ok is one td .I want both of them to come side by side


A: I maybe think that you problem is that you use percentage instead of a fixed width. I tried it on my own computer and this style was applied to the table data. 
You could try to expand your css:
.replyIcontd
{
   width: 200px;
   background: red;
}

This might also work for you, and then you just have to use a more appropriate value then 200px. It is important to notice that the width of 5% is relative to the width of the table. 

A: You forgot to give closing / on the elements you created dynamically.
 $('<tr />').append($('<td />').append($imageicon).addClass('replyIcontd'), $('<td />').text('hii'));


Update
I made some pretty big changes on your script, with a proper way to do this.
 var $imageicon = $('<img />', {
     'src' : '../../Content/images/ReplyIcon.png',
     'class' : 'replyIcon'
 });

 var $table = $('<table/>', {
     "class" : "replyContent",
     "id" : "replayArea",
     'html' : $('<tr />', {
                 'html' :  $('<td />', {
                     'class': 'replyIcontd',
                     'html' : $imageicon
                 }).html()+$("<td />", {
                     'text' : 'hii'
                 }).html()                     
              })

 });

Demo
