On Dec 21, 2007, at 12:24 PM, LeonL wrote:



Hello everyone.
I've been trying for some time now to make this code to execute ONLY if a
variable called edit equals to 1:
The code:
        $(".item_title").editable("operator.php",{
                submitdata: {'type': 'title'},
                width: 250
        });//EOE

Does anybody have an idea how to do that??
Thanks.


This is one way to do it:

-cut-
 var check = 1;

 $(".item_title").editable("<?php print $url ?>echo.php", {
     event     : "edit",
 }).bind("click", function() {
   if (check) {
       $(this).trigger("edit");
   }
 });
-cut-

Basically it binds custom event "edit" to start Jeditable. Then after click it check if variable "check" is true. If it is it triggers "edit" event on Jeditable.

--
Mika Tuupola
http://www.appelsiini.net/

Reply via email to