html - How can I set location for a button on-click event using jQuery? -
i have page:
here on homepage, find button called "get quote". when click on button want open link "google.com".
i tried jquery using code it's not working.
jquery(document).ready(function($) { $('.wpcf7-form-control wpcf7-submit').click(function() { window.location = "www.google.com/index.php?id="; }); }); this site made wordpress , used plugin contact form 7
<div class="contact-frm"> <div class="right"> <?php echo do_shortcode('[contact-form-7 id="9" title="get quote"]'); ?> </div> </div> can please me solve problem?
thanks in advance!
you forgot 2 things:
- add
http://in front of url. - change
wpcf7-submit.wpcf7-submit.
use way:
jquery(document).ready(function($) { $('.wpcf7-form-control .wpcf7-submit').click(function() { window.location = "http://www.google.com/index.php?id=" + $(this).attr("id"); }); });
Comments
Post a Comment