Use $.prop() to set modal id to avoid some problems.
Improving function for setting id to Modal