scottdominic94 scottdominic94 - 1 year ago 64
Javascript Question

jQuery submit requiring 2 clicks to run

I'm trying to create a webpage using jQuery, HTML and php that will update information in my mySQL database, but when I click submit on the form, it doesn't run, but if I click it twice it does. How can I get this to work on a single click?

<form id="homeform">
<textarea name="editor" id="editor" rows="25" cols="80">
CKEDITOR.replace( 'editor' );
<input type="submit" value="Update Home Page">
<script type='text/javascript'>
$("#homeform").submit(function(event) {
$.post( "homeupdate.php", $( "#homeform" ).serialize());

Answer Source

It might be a problem on the CKEDITOR's side. You might try to put your code inside the following:

CKEDITOR.on("instanceReady", function(event)
     //put your code here
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download