aakash22
10 years agoOccasional Contributor
How to pass variable to eval(JavaScript) function
i have been trying to pass date value to my uneditable date filed.
so i have retrieved the javascript ID(startDateCalendar_dateTextBox) for the field and i am trying to pass multiple values to the same.
contentDocument.Script.eval("var tr = document.getElementById('startDateCalendar_dateTextBox'); tr.value='swap';");
So, the problem here is passing multiple values to this field. i want to data drive this.
Is there a specific reason you're using eval? Can't you access the object directly like this?
var obj = page.FindChildByXPath("//*[@id='startDateCalendar_dateTextBox']");
// Or narrow down the search by specifying the HTML tag, for example: // var obj = page.FindChildByXPath("//input[@id='startDateCalendar_dateTextBox']");
obj.value = ...;