Hi Guys, I've having problem trying to trigger a hidden button with javascript I have the following code
- <script>
- document.getElementById("myBtn").onclick = doFunction;
- </script>
-
- <a href="#" onclick="javascript:doFunction();">Request a quote</a>
-
- <input type="hidden" id="myBtn" value="REQUEST A QUOTE" />
-
- <div id="myModal" class="modal">
- <!-- Modal content -->
- <div class="modal-content">
- <div class="modal-header">
- <span class="close">×</span>
- <h2>Quote</h2>
- </div>
- <div class="modal-body">
- <cc1:GetQuote ID="ctrl1" runat="server" />
- </div>
- <div class="modal-footer">
- <h3>Medicare Advantage & Medicare Supplement Quote</h3>
- </div>
- </div>
- </div>
As you notice I try to push the hidden button using a <a href="" onclick="javascript:doFunction():">Request Quote</a> instead of using the input button, but somehow it does not trigger it.
If I changed the Type=hidden" button to type="button" and click on the button then the popup modal works with no problem, but I do not want to use the button instead I'd like to use the <a href=""></a> tag to keep my web template to look as it should.
Also how can I trigger the close [X] from the popup modal by adding an input button inside the form instead clicking the Top->Right->[X] Close link on the popup modal.
Thank you guys