javascript - Update Form Hidden Field Value wit button ID? -


i have bunch of popover buttons open same form. need button id value hidden field inside form.

html buttons:

<a type="button" class="pop" data-toggle="popover" id="1">button 1</a> <a type="button" class="pop" data-toggle="popover" id="2">button 2</a> <a type="button" class="pop" data-toggle="popover" id="3">button 3</a> ... 

popover form:

<div id="popover-content" class="hide"> <form> <input name="name" type="hidden" value="buttonidvalue"> ... 

popover js:

$('.pop').popover({          html : true,         content: function() {             return $("#popover-content").html();         }     }); 

you can access element triggered popover this within function bound content. update code be:

$('.pop').popover({          html : true,         content: function() {             $('#hidden-input').val(this.id);             return $("#popover-content").html();         }     }); 

of course using whatever correct selector hidden input field.


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? -