C#,vb.net,MVC,Jquery,javascript,jscript,vbscript,html,vb,sharepoint,COM,WPF,WCF,Wwf,Asp,Asp.net,questions & answers,

Latest in Sports

Tuesday, August 21, 2012

Jquery Datepicker Issue-dynamically add rows in table having datepicker ...

Hi ALL

I am facing following issue in jquery date picker control:-

I am trying to dynamically add rows in table having datepicker
control, but after clicking add button date picker appears in row with
proper pop up but am not able to select hyperlinked dates. Below is
code snippet to create dynamic rows in table with date picker column.

<script type="text/javascript">

var id = 0;
debugger; // Add button functionality
$("table.GeneralTable button.add").click(function () {
debugger; id++; //Increments row ID
var master = $(this).parents("table.GeneralTable");
// Get a new row based on the prototype row
var prot = master.find(".prototype").clone(); //Making
clone of the rows to be added on click button
prot.attr("class", "")
prot.find(".id").attr("value", id);
master.find("tbody").append(prot); //Finds
the location and appends the row

// DatePicker control to be applied on particular column



prot.find('#dtReceivedDate').datepicker({

dateFormat: "mm/dd/yy",

showOn: 'both',

buttonImageOnly: true,

buttonImage:
'/content/themes/base/images/calendar.png'

});
return false;
});
// Remove button functionality
$("table.GeneralTable button.remove").live("click", function () {
$(this).parents("tr").remove();
});
});
</script>


Any help will be appreciated .

-Ankur

1 comment:

  1. Hey there! Quick question that's entirely off topic. Do you know how to
    make your site mobile friendly? My weblog looks weird
    when viewing from my iphone. I'm trying to find a theme
    or plugin that might bee able to fix this problem. If you have any suggestions, please share.
    Appreciate it!

    ReplyDelete