javascript - Getting @html.hidden value -
i trying value variable.
@html.hidden("myvar", 0);
this variable updated according link clicked
<script type="text/javascript"> $(document).ready(function () { $(".resend").click(function (){ $('#myvar').val(this.id); console.log(document.getelementbyid('myvar').value); $("#mymodal").modal('show'); }); }); </script>
this javascript call model pop up.
<div id="mymodal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!— modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">×</button> <h4 class="modal-title">confirmation</h4> </div> <div class="modal-body"> <p>are sure want resend registration link patient?</p> </div> <div class="modal-footer"> <a href='@url.action("therapistresendlinktopatient", "account", new { pid = want change variable #myvar })' style="text-decoration:none;"> <input type="button" class="btn btn-primary" value="confirm" /> </a> <button type="button" class="btn btn-default" data-dismiss="modal">cancel</button> </div> </div> </div> </div>
i change pid = #myvar on pop box, not know how can insert value. 1 have clue how can reference pid #myvar?
thanks
to accomplish best way insert value every time #myvar changed update href
attribute, .attr() contain new value of #myvar. example of doing in javascript
adding:
$('#confirmbutton').attr('href','@url.action("therapistresendlinktopatient", "account", new { pid = '+document.getelementbyid('myvar').value+' })');
you need add id href wrapper around button, this:
<a href='@url.action("therapistresendlinktopatient", "account", new { pid = '+document.getelementbyid('myvar').value+' })' style="text-decoration:none;" id="confirmbutton"> <input type="button" class="btn btn-primary" value="confirm" /> </a>
i hope helped
Comments
Post a Comment