This might seem a question not related to this forum.
But, according to Salesforce Security reviews, we are not supposed to use innerHTML in our code. Since, this could cause Cross-Site-Scripting(XSS) issues as mentioned here: https://developer.salesforce.com/page/Secure_Coding_Cross_Site_Scripting
element.innerHTML = '<htmlcode>may be some script as well</htmlcode>';
Could you please suggest, how to replace the best way? Or, with function that is not unsupported by Salesforce