Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript/Php Chat - Enter isn't work in one textbox
    primarykey
    data
    text
    <p>So I made a chat with textboxs. If I press ENTER the chat send the message. It's fine, but in "Warning" thing this isn't work. When I'm pressing Enter, it isn't work. Can someone help me? </p> <pre><code>//This is for normal users: &lt;form name="message" action=""&gt; &lt;input name="usermsg" type="text" id="usermsg" size="63" /&gt; &lt;input name="submitmsg" type="submit" id="submitmsg" value="Send" /&gt; &lt;/form&gt; &lt;br&gt; //This is for moderators: &lt;form name="moderating" method="post" action=""&gt; &lt;hr align="center"&gt; &lt;br&gt; &lt;p&gt;&lt;b&gt;Write in color:&lt;/b&gt;&lt;/p&gt; &lt;script type="text/javascript" src="color_picker/jscolor.js"&gt;&lt;/script&gt;Select color: &lt;input class="color" name="color_value" type="text" id="color_value" value="FF0F0F"&gt; &lt;input name="colormsg" type="text" id="colormsg" size="25" /&gt; &lt;input name="submitcolormsg" type="submit" id="submitcolormsg" value="Send" /&gt; &lt;br&gt;&lt;br&gt; &lt;p&gt;&lt;b&gt;Warning&lt;/b&gt;&lt;/p&gt; //Is this wrong?! : &lt;input name="warningmsg" type="text" id="warningmsg" size="63" /&gt; &lt;input name="submitwarningmsg" type="submit" id="submitwarningmsg" value="Warning" /&gt; &lt;br&gt;&lt;br&gt; &lt;p&gt;&lt;b&gt;Clear chat log&lt;/b&gt;&lt;/p&gt; &lt;input name="clear_button" type="submit" id="clear_button" value="Clear" /&gt; &lt;br&gt;&lt;br&gt; &lt;p&gt;&lt;b&gt;Turn on/off chat&lt;/b&gt;&lt;/p&gt; &lt;input type="radio" name="chat_status_group" id="on" value="on" checked&gt;&lt;b&gt;On&lt;/b&gt; -&lt;input type="radio" name="chat_status_group" id="off" value="off"&gt;&lt;b&gt;Off&lt;/b&gt; &lt;input name="chat_status_button" type="submit" id="chat_status_button" value="Ok" /&gt; &lt;/form&gt; &lt;/div&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; // jQuery Document $(document).ready(function(){ $("#submitmsg").click(function(){ var clientmsg = $("#usermsg").val(); $.post("***.php", {text: clientmsg}); $("#usermsg").attr("value", ""); return false; }); $("#submitcolormsg").click(function(){ var clientcolormsg = $("#colormsg").val(); var color = $("#color_value").val(); $.post("***.php", { text: clientcolormsg, color: color }); $("#colormsg").attr("value", ""); return false; }); //And here is the wrong?! : $("#submitwarningmsg").click(function(){ var post_warningmsg = $("#warningmsg").val(); $.post("***.php", {text: post_warningmsg}); $("#warningmsg").attr("value", ""); return false; }); $("#clear_button").click(function(){ $.post("clear.php"); return false; }); $("#chat_status_button").click(function(){ var statusmsg = "on"; if(document.getElementById('on').checked) { statusmsg = "on"; } else { statusmsg = "off"; } $.post("chat_status.php", { text: statusmsg }); return false; }); . . . }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I think the problem is here:</p> <pre><code>$("#submitwarningmsg").click(function(){ var post_warningmsg = $("#warningmsg").val(); $.post("***.php", {text: post_warningmsg}); $("#warningmsg").attr("value", ""); return false; }); </code></pre> <p>why </p> <blockquote> <p>$("#warningmsg").attr("value", "");</p> </blockquote> <p>isn't work?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload