Event.preventDefault() doesn't work?

$("#singlechatpanel-1 #sendMessage").click(function(Event)
$("#singlechatpanel-1 .subpanel ul").append('<li><span><img src="./images/chat-thumb.gif"/>Aristona: Test message.</span></li>');

<form name="chatForm" id="chatform">
 <input type="text" id="message" name="message"><br>
 <input type="button" name="sendMessage" id="sendMessage" value="Send Message">

When I click on button with mouse, it normally sends the data, but if I press enter while typing something into textbox, page refreshes and URI goes to message?what_I_typed.

How to prevent it? I need to use enter button since it is a chat application.


Bind to the form's submit event instead.

$("#chatform").submit(function(e) {
    $("#singlechatpanel-1 .subpanel ul").append('<li><span><img src="./images/chat-thumb.gif"/>Aristona: Test message.</span></li>');

Need Your Help

What alternatives exist to UML to graphically represent software models

uml modeling

Excluding UML, What other formal methodologies exist to visually represent software models?

alignment issue with RecyclerView in android 4.4

android xml layout recyclerview

I am implementing a RecyclerView in my application and it is working. But i am facing a problem with the list item alignment in Recyclerview.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.