Search code examples
javascriptgrailsgsp

is it possible to set hidden field value using jquery in grails?


I need to perform some operation using javascript to set the value of a hiddenfield.

<g:hiddenField name="city" value="" />

So onclick of a button I should set value of 'city' based on js function call. Is it possible?


Solution

  • Yes, it's possible.

    $("input[name='city']").val("some value to set here");