vendredi 9 janvier 2015

Javascript function error


Vote count:

0




I have no clue how to solve my error. Been at it for hours.


The weirdest thing is that the same exact function works for one and not for the other.


My html for 1:



<a href="#" onClick="deletePeriod('discTable1', '1');return false;" class=" btn btn-danger btn-sm btn-block">Delete</a>


My html for another:



<a href="#" onclick="deletePeriod('discTable2', '1');return false;" class=" btn btn-danger btn-sm btn-block">Delete</a>


My javascript function:



function deletePeriod(table, id) {
var rowNum = id;
if (rowNum == 1) {
$('.' + table).val("");
$.datepicker._clearDate('.datePickStart');
$.datepicker._clearDate('.datePickEnd');
} else {
$('#' + table + 'period' + id).remove();
countPeriods--;
}
}


So when i click on the first button, it executes the above function fine. However, when i click the second button, it results in a unknown script code sort of error and it will remove the first datepicker values when it is just suppose to remove it's own values.


Would appreciate it if someone could help!



asked 57 secs ago







Javascript function error

Aucun commentaire:

Enregistrer un commentaire