When I call the javascript function from the anchor tag the following error is coming 'VM12 jquery.dataTables.min.js:62 Uncaught TypeError: Cannot read property 'style' of undefined' Here is my code, When Please can you help me ?
<a class="btn btn-primary form-control" onclick="CallLogCreate()" data-ajax="true" data-ajax-mode="replace" data-ajax-update="#content" data-toggle="tooltip" title="New Record"><span class="control-label-left padding-left-ten">Add New Record</span></a>
function CallLogCreate() {
var depot = $('#dropdownDepot').val();
var departmentNo = $('#dropdownDepartment').val();
var employeeid = $('#dropdownEmployee').val();
alert(depot);
var href = "/Home/UpdateClockEntry?depotno=" + depot + "&departmentId=" + departmentNo + "&employeeid=" + employeeid;
$("#lnkFilter").attr('href', href);
$("#lnkFilter").click();
}
public IActionResult UpdateClockEntry(int depotno, int departentid,int employeeid)
{
return view()
}
Member
411 Points
1327 Posts
Uncaught TypeError: undefined Error
Mar 05, 2020 07:02 AM|polachan|LINK
When I call the javascript function from the anchor tag the following error is coming 'VM12 jquery.dataTables.min.js:62 Uncaught TypeError: Cannot read property 'style' of undefined' Here is my code, When Please can you help me ?
Contributor
3140 Points
983 Posts
Re: Uncaught TypeError: undefined Error
Mar 05, 2020 07:53 AM|Yang Shen|LINK
Hi polachan,
This error means that you are trying to get the style attribute of an undefined element.
Are you sure that you provided the right code? since there's no jquery datatable related code and literally no "style" in your provided code.
Anyway, the reason for this issue is most likely no value assigned to the corresponding object.
For example, in the js code you have:
XXX.style
but theXXX
never be assigned a specific value or element.Please check jquery.dataTables.min.js:62 and you might find the true reason.
Best Regard,
Yang Shen