How can I change attribute value of Html tag ? : I have this HTML code.

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-html -->


        <div class="container-fluid">
            <div class="block-header">
                <h2>SECURITY DASHBOARD</h2>
            </div>
            <div id="burayaset">
                <!-- Widgets -->
                <div class="row clearfix">
                    <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12">
                        <div class="info-box-4">
                            <div class="icon">
                                <i class="material-icons col-blue">remove_from_queue</i>
                            </div>
                            <div class="content">
                                <div class="text">HOSTS</div>
                                <div  id="HostsBar" class="number count-to" data-from="0" data-to="125" data-speed="15" data-fresh-interval="20"></div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12">
                        <div class="info-box-4">
                            <div class="icon">
                                <i class="material-icons col-blue-grey">storage</i>
                            </div>
                            <div class="content">
                                <div class="text">PRODUCTS</div>
                                <div class="number count-to" data-from="0" data-to="257" data-speed="1000" data-fresh-interval="20"></div>
                            </div>
                        </div>
                    </div>
                    <div class="col-lg-4 col-md-3 col-sm-6 col-xs-12">
                        <div class="info-box-4">
                            <div class="icon">
                                <i class="material-icons col-cyan">warning</i>
                            </div>
                            <div class="content">
                                <div class="text">VULNERABILITIES</div>
                                <div class="number count-to" data-from="0" data-to="1225" data-speed="1000" data-fresh-interval="20"></div>
                            </div>
                        </div>
                    </div>
                </div>

<!-- end snippet -->

I want to change count-to value with data that come from backend. How can I do that in Javascript. I tried 

document.getElementById("HostsBar").setAttribute("data-to", "120"); 

But it not worked.
