I have list of values available in my velocity template
#set ($allItems = $action.getProduct())
#foreach ($item in $allItems)
<div class="wrap" id="productName">$item.getProductName()</div>
#end
now I want them to be available in java script code inside a dialog box.
actor.addPanel("Panel 1", "<label for='product'>document.getElementById('#productName')</label>" + "<br>" + "<input id='dialoginput' type='text' value=''>Input 1</input>" + "<br>" + "<input id='dialoginput1' type='text' value=''>Input 2</input>", "panel-body");
But it is not printing the value of productName. How can I get the value?
You are using the string "productName" for all your id's. Use $item.getProductName() in stead: