Pass input text value to javascript not working

Good day. I have read and done almost all of the solution in the questions but cant seem to solve my problem. As written in my question, in mvc, i am passing a value from controller to view a string and then get by javascript to run a modal if ever a certain condition is met. please help. thanks.

here is the code in my controller:

    public ActionResult Series()
    {
        List<sample> series = db.samples.Where(x => x.status == "False").ToList();
        if ( series.Count == 0)
        {
            ViewBag.Info = "None";
        }
        else {
            ViewBag.Series = series;
            ViewBag.Info = "Have";
        }
        return View();
    }

My View:

<input type="text" value="@ViewBag.Info" id="info" name="info" />

My Javascript:

@section Scripts{
<script>
$(window).on('load', function () {
    var modelll = document.getElementById("@(ViewBag.Info)").value;
    var s_end = document.getElementById("myNumber2").value;
    var s_current = document.getElementById("myNumber3").value;
    var s_status1 = document.getElementById("status").value;

    var s_id1 = parseInt(document.getElementById("myNumber").value);
    var s_end2 = parseInt(s_end, 10);
    var s_current2 = parseInt(s_current, 10);
    var x = parseInt(s_current, 10) + 1;

    document.getElementById("item1").value = s_id1;
    document.getElementById("item2").value = s_end;
    document.getElementById("item3").value = x;
    document.getElementById("status2").value = s_status1;

    if (modelll === 'Have')
    {

        if ((s_current2 > s_end2) && (s_current2 != s_end2)) {
            $('#myModal').modal({ backdrop: 'static', keyboard: false });
            $('#myModal').modal('show');
        }
    }
    else
    {
    $('#myModal').modal({ backdrop: 'static', keyboard:false });
    $('#myModal').modal('show');
    }

});
</script> 

}

getElementById need an ID but you are passing @ViewBag.Info. change it to :

var modelll = document.getElementById("info").value;

also you are making many extra variables which are not really needed. for example to get what you have in s_current2, you can use

var s_current = parseInt(document.getElementById("myNumber3").value, 10);

no need to create another variable to convert it to integer.

To get the value from textbox

var modelll = document.getElementById(“info”);

To set the value to textbox

document.getElementById(“info”).value = var modelll;

you are using @ViewBag.Info instead of element id.

Following line is causing the problem in your code :

  var modelll = document.getElementById("@(ViewBag.Info)").value;

    // document.getElementById needs Id but you are passing @(ViewBag.Info) which is wrong

    var modelll = document.getElementById("info").value; //info id of your textbox
// now check
  if (modelll === 'Have')
    { }
  else
    { }