html - How can I set location for a button on-click event using jQuery? -


i have page:

link

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:

  1. add http:// in front of url.
  2. 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

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -