Jquery trigger not working in chrome on pc

Hi I’ve got the below code which clicks a button when another button is clicked. But it’s doesn’t work in chrome, I’ve only tested it on PC at the moment. The other issue I have is it only works when I include the “alert” (all browsers). I want to remove the alert. Any help would be great. Cheers

$( "input#job_preview_submit_button" ).click(function() {
	 $('input#gform_submit_button_6').trigger('click');


 alert('Thank you');

Hi,

Could you post a link to a page where I can see this not working?

I don’t know what your original code looks like, but here is my best guess. it works in all browsers. I have commented out the alert and added an onclick handler in the BB button to tell you when it is triggered by your submit button. :slight_smile:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Button Click</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>

<style type="text/css">
 body { font-family:arial, helvetica, sans-serif; font-weight:normal; font-size:13px; color:#000; text-align:left; margin:3px 0px; }
 #wrap { width:500px; height:500px; margin:20px;  }
</style>
</head>

<body>

<div id="wrap">
  <input id="job_preview_submit_button" type="button" value="Submit" name="job_preview">
  <input id="gform_submit_button_6" type="button" onclick="alert('You Clicked BB')" value="bb" name="gform">
</div>
<script type="text/javascript">
 $("#job_preview_submit_button").click(function() {
	 $('#gform_submit_button_6').trigger('click');
 });
 //alert('Thank you');
</script>

</body>

</html>


Hi guys, your right it should definatley be working. I think it is a timing issue. i.e the button is executing it’s regular activity before running my function. That’s all i can think it could be I will let you know how I go. Cheers