[#211]Improve the javascript code to prevent the js error to thrown 
when some html elements missing in the template.