Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6125577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:15:51+00:00 2026-05-23T16:15:51+00:00

I have a chat on my site that runs on jQuery. However, the problem

  • 0

I have a chat on my site that runs on jQuery. However, the problem is that on IE9, when the user presses Enter on the input text field it submits twice. I am assuming that it may be thinking that it has to also click the button?

Any help?

<script>
$('#message').keypress(function(event){
    var keycode = (event.keyCode ? event.keyCode : event.which);
    if(keycode == '13')
    {
        sendPostMessage();
    }
});

$('#sendMessage').click(function(event){
    if(this.disabled == true)
    {
        alert('meh');
    }
    var toSend = $('#message').val();
    if(toSend.length > 1 && toSend.length < 160)
    {
        sendPostMessage();
        //alert('You are sending a message.' + toSend);
    }
    else
    {
        alert('Invalid message.');
        this.disabled = true;
        window.setTimeout(function(){
            $('#sendMessage').removeAttr('disabled');
        }, 3000);
    }
});

jQuery.fn.compare = function(t) {
    if(this.length != t.length)
    {
        return false;
    }

    var a = this.sort(), b = t.sort();
    for(var i = 0; t[i]; i++)
    {
        if(a[i] !== b[i])
        { 
            return false;
        }
    }

    return true;
};

function sendPostMessage()
{
    $.post("http://www.prizetv.org/alpha/ajax.php", { "message": $('#message').val() }, function(data) {
            //alert(data);
            $('#message').val('');
        }
    );
}

var oldMessages;
var temp;
var scroll;

$(document).ready(function() {update();});



function update() { 
    $.getJSON("http://www.prizetv.org/alpha/ajax.php", function(json) {
        $("#actual").empty();

        jQuery.each(json, function(i, val) {
            var test = val[0] + "&nbsp;<b>" + val[1] + "</b>:&nbsp;" + val[2] + "<br />";
            $("#actual").append(test);
        });
        $("#actual").scrollTop(0);
    });

    setTimeout(update, 1000);
}
</script>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:15:51+00:00Added an answer on May 23, 2026 at 4:15 pm

    Call e.preventDefault() to prevent IE from handling the Enter keyrpess itself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have problem with session in cakephp.I have one file chat.php that is in
I'm trying to build a site that runs without refreshes, using Jquery and PHP
I have a script that runs every hour on my php site. In that
I have a chat that uses textarea instead of text for obvious reasons. This
I have a chat on a web site that looks like this. I am
I have a WCF chat service that accepts duplex tcp connections. A single duplex
I have written a small chat app that uses mysql + php to facilitate
I have heard that web-based chat clients tend to use networking frameworks such as
I have a really simple chat application on a site which works pretty good.
I want to create my site and in the page have it so that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.