Jquery if contenteditable=true event
contenteditable, jquery
Solution
this is not defined. Here Ya go http://jsfiddle.net/dqEE2/2/
$( "#hello" ).hide();
$(function() {
$("div").click(function() {
if ($(this).attr("contentEditable") == "true") {
$( "#hello" ).show();
alert("yes");
} else {
alert("no");
$( "#hello" ).hide();
}
});
Problem
Im trying to detect if the element I have clicked on is contentEditable. I have tried this: ``` $( "#thediv" ).hide(); $(this).click(function() { if ($(this).is("[contenteditable='true']")) { return true; $( "#thediv" ).show(); alert('hi'); } else if ($(this).is("[contenteditable='false']")) { return false; $( "#thediv" ).hide(); alert('hi'); } }); ``` AND ``` $( "#thediv" ).hide(); $(this).click(function() { if ($(this).attr("contentEditable") == true) { $( "#thediv" ).show(); alert('yes'); } else { $( "#thediv" ).hide(); alert('no'); } }); ``` How can I get this to work? Here's a fiddle