RackM
RackM

Reputation: 459

Math.floor returns NaN

I am using javascript to remove .0 from the value in innerHtml. It is working fine in localhost but when i uploaded at server it is returning 'NaN'. When i reload the page it shows value for a second and then it shows NaN. Following is javascript function

<script type="text/javascript">

    $(document).ready(function () {

        var aliasstart = document.getElementById('aliasstart').innerText;
        document.getElementById('aliasstart').innerText =parseInt( Math.floor(aliasstart));
    });
</script>

AliasStart is of type decimal in MVC model class I have given the part of the code. Please help

Upvotes: 2

Views: 8305

Answers (1)

Cold_Class
Cold_Class

Reputation: 3484

Try it the other way 'round Math.floor(parseFloat(aliasstart));

Upvotes: 2

Related Questions