JSFiddle - React, Tailwind, and code Playground
by karimkhan
HTML
<script src="https://github.com/karimkhanp/commentbox_quora/blob/master/yepinol/Wall/wallscript.js"></script>
<div contenteditable="true" class="commentMark" id="commentMark-<?php echo $row['p_id'];?>" onblur="if (this.value=='') this.value = 'Write a comment'" onfocus="if (this.value=='Write a comment') this.value = ''" onKeyPress="return SubmitComment(this,event)" wrap="hard" name="commentMark" style=" background-color:#fff; overflow: hidden;">Write a comment</div>
JavaScript
$(function(){
alert("hi");
$('.commentMark').keypress(function (e) {
if (e.keyCode == 13) {
alert('You pressed enter!');
}
alert("hidden");
});
});
$(document).ready(function(){
alert("hi");
$('#watermark').bind('keyup', function() {
var a = $("#watermark").val();
if(a != "")
{
$('.gbutton').css('opacity', '1');
}
else
{
$('.gbutton').css('opacity', '.5');
}
} );
$(document).ready( function() {
$("#viewclick").click( function() {
// this will fire when you click view
alert("click");
});
$("#editclick").click( function() {
// this will fire when you click edit
// hide the view button here and upon submit, show it again
// like $("#viewclick").hide() or $("#viewclick").fadeOut()
});
});
$('commentMark').bind('keydown', function(event) {
//console.log(event.keyCode);
alert("hi");
switch(event.67){
//....your actions for the keys .....
alert("hi");
}
}
$('.commentBox').hide();
$('.commentMark').val("Write a comment");
$('#shareButtons').click(function(){
var a = $("#watermark").val();
if(a != "")
{
var keepID = $('#keepID').val();
var posted_on = $('#posted_on').val();
$.post("wall.php?value="+a+'&x='+keepID+'&p='+posted_on, {
}, function(response){
$('#loadpage').prepend($(response).fadeIn('slow'));
$("#watermark").val("");
});
}
});
$('.commentMark').livequery("focus", function(e){
return;
var parent = $(this).parent();
$(".commentBox").children(".commentMark").css('width','320px');
$(".commentBox").children("a#SubmitComment").hide();
$(".commentBox").children(".CommentImg").hide();
var getID = ...