diff --git a/converse.js b/converse.js
index 6e42484c4..f4cfa6c31 100644
--- a/converse.js
+++ b/converse.js
@@ -2517,13 +2517,11 @@
''),
connect: function ($form, jid, password) {
- var button = null,
- connection = new Strophe.Connection(converse.bosh_service_url);
if ($form) {
- $button = $form.find('input[type=submit]');
- $button.hide().after('');
+ $form.find('input[type=submit]').hide().after('');
}
- connection.connect(jid, password, converse.onConnect);
+ converse.connection = new Strophe.Connection(converse.bosh_service_url);
+ converse.connection.connect(jid, password, converse.onConnect);
},
initialize: function (cfg) {