Thanks Mika, but it doesn't seem to work for me :(
What I did is (for testing):

        $(".item_title").editable("operator.php",{
                submitdata: {'type': 'title'},
                width: 250,
        }).bind("click",function() {
                alert(edit)
        });

This will work fine - alert the edit var value.
However, when adding 'event: "edit"' it wont do a thing:


        $(".item_title").editable("operator.php",{
                submitdata: {'type': 'title'},
                width: 250,
                event: "edit"
        }).bind("click",function() {
                alert(edit)
        });

Is there something I'm doing wrong?
Thanks!


Mika Tuupola wrote:
> 
> 
> 
> 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/
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Conditional-events-tp14453255s27240p14461121.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to