0
 $("#calBox0").append(message); //calling this id"calBox3",this statesment is right; 

but now,

var cal=calBox0;
$("#cal").append(message); //has errors ;

i want to know why?

 <tr > //grid  
    <td class="calBox" id="calBox0"></td>  

</tr>  
Rohan Kumar
  • 40,431
  • 11
  • 76
  • 106

2 Answers2

3

try this

var cal= 'calBox0';

$('#'+cal).append(message);
Alien
  • 3,658
  • 1
  • 16
  • 33
0

$("#cal") here "cal" is a String it self you have to use a variable having value 'calBox0' so use $("#"+cal) instead of $("#cal")

Sindhoo Oad
  • 1,194
  • 2
  • 13
  • 29