tags:

views:

43

answers:

2

Hi, I have the following HTML5 content:

<section contenteditable="true" id="editable" class="ui-selectee ui-selected">
<span>something</span>
<span>something</span>
<span>something</span>
</selection>

I have a toggle function that turns on edit mode. I want to make the contenteditable="true" or contenteditable="false" on that toggle function. I've it would be easy if I would have to change a class or ID. Ive tryed to .html the #edit or append but I was unable to.

Any tips on changing contenteditable="true" to contenteditable="false" ? Thanx

+3  A: 

You are going to want to use the attr() function.

To set the value to true:

attr("contenteditable", "true");
tomk
Thank you. It works
Mircea
+1  A: 

....

$('selector').click(function(){
  $('#editable').attr('contenteditable', false);
});

You can use the if-else condition to check its current status and set the required on accordingly using:

$('#editable').attr('contenteditable', false); // or true
Sarfraz
thanx that does it
Mircea
@Mircea: you are welcome ...... :)
Sarfraz