jquery - How to access values inside javascript from .vm file -


i have list of values available in velocity template

#set ($allitems = $action.getproduct()) #foreach ($item in $allitems)     <div class="wrap" id="productname">$item.getproductname()</div> #end 

now want them available in java script code inside 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 not printing value of productname. how can value?

you using string "productname" id's. use $item.getproductname() in stead:

#set ($allitems = $action.getproduct()) #foreach ($item in $allitems)     <div class="wrap" id="$item.getproductname()">$item.getproductname()</div> #end 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -