Double-Click here to respond... (How I cant just click)
Ok so its probably right in front of me but for some reason i cannot see it.
So i want this code to just be able to click and not dblclick (its easier). Here is my code.
-
$(document).ready(function(){
$(".respond").bind('dblclick',replaceHTML)
function replaceHTML(){
$(this).html("").html("<form><textarea id='respond_to_conversation' class='respondBox'></textarea></form><center><a class='btnSend menu'>Send</a> | <a class='btnCancel menu'>Cancel</a></center>")
}
$(".btnSend").live('click',
function(){
//The message
var message = $("#respond_to_conversation").val();
//The id of the message
var id = $('.respond').attr('name');
//Replace message with the loading bar
$(this).parent().parent().html("<center><img src='http://localhost/scholarly/a2/engine/library/css/images/loading.gif'/></center>")
//Encode the text so that its ok for the url
var newMessage = php_urlencode(message);
$.ajax({
type: "POST",
url: "http://localhost/scholarly/a2/engine/library/functions/send_conversation.php",
data: "message="+newMessage+"&id="+id+"&AjaxStartConversationInsertion=1",
success: function(html){
// Some code here to reflect a successful edit;
$(".respond").html(html);
}
});
});
$(".btnCancel").live("click",
function()
{
$(this).parent().parent().html("Double-Click to respond...");
});
Ok so when the user dblclicks on the message (All it says is "Double-click to respond") it changes the html to a simple textarea and a send and cancel button. Well everything is working fine and dandy BUT when i change
-
$(".respond").bind('dblclick',replaceHTML)
to
-
$(".respond").bind('click',replaceHTML)
it breaks the whole thing. It replaces the Html with the form and div and everything but when i click in the textarea it doesnt let me type anything, it just flashes or whatever. But when I click and hold and then drag my mouse off of the textarea itll let me type but when I click send it produces and error (from my ajax php script)..So i am stuck, does someone have an idea? Thanks in advance (Hopefully these forums are better than the pHP ones, cause they suck :-/ lol )
