I have a table and each of its td has a unique id that corresponds to some time intervals (0800 til 0830... 083
td
0800
0830
083
I don't know if this solves your problem but instead of:
$("#tbIntervalos").find("td").attr("id", horaInicial);
you can just do:
$("#tbIntervalos td#" + horaInicial);