简体   繁体   中英

How to pass a parameter to a jquery/javascript function using execScript

I have the following code to select the first item in a kendoDropDownList. By changing the parameter in select from a 1 to a 2, I can select the second item. Is there a way to pass a parameter, as in 1 or 2 or 3 etc. to this line ?

ie.Document.parentWindow.execScript "$('#drgdTankCrude').data('kendoGrid').dataItem($('#Tank_ID').data('kendoDropDownList').select(1));"

I've tried the following by setting a variable called xp using double quotes, single quotes, no quotes, but nothing happens unless it's actually a number of valid items in the dropDownList.

ie.Document.parentWindow.execScript "$('#drgdTankCrude').data('kendoGrid').dataItem($('#Tank_ID').data('kendoDropDownList').select(""xp""));"

Slai gave me the correct answer. The line is posted below.

Setting the xp variable, it was passed correctly

ie.Document.parentWindow.execScript "$('#drgdTankCrude').data('kendoGrid').dataItem($('#Tank_ID').data('kendoDropDownList').select(" & xp & "));"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM