Variable selector not working

Variable selector not working

I cannot seem to get this variable selector to work.. grr

  1. $('button').click(function(){
  2.     editCells();
  3. });
  4. var d=0;
  5. function editCells() {
  6. d++;
  7.     inputType ='<span id="inDate'+d+'">To be replaced</span><input type="hidden" id="inDatepicker'+d+'" />';
  8.     createDatpicker(d);
  9.     $("#dialogue").append(inputType);
  10. }

  11. function createDatpicker(n) {
  12. $("#inDate"+n).text('date');
  13.     console.log("#inDate"+n);
  14. }

http://jsfiddle.net/bcraig/jb755/1/