Giter Club home page Giter Club logo

Comments (10)

tuupola avatar tuupola commented on August 25, 2024

I woudl rather leave the choice of namespacing or not to the developer. You can call with Jeditable with:

 $('div').editable('http://www.example.com/save.php' {
      event: 'click.editable'
 });

However I agree the default event should be namespaced. Will fix. Thanks for the heads up!

from jquery_jeditable.

tuupola avatar tuupola commented on August 25, 2024

Fixed in Git.

from jquery_jeditable.

twig avatar twig commented on August 25, 2024

Hi I'm having trouble trying to figure out WHEN to destroy the jEditable instance.

I tried onblur but that prevented the controls from being removed.

from jquery_jeditable.

twig avatar twig commented on August 25, 2024

what i currently have is

function comment_edit() {
  var obj = $(this);
  var id = obj.attr('id').split('-')[2];

  var options = {
    onblur: function() {
      $('#comment-' + id + ' .comment-body').reset().editable('destroy');
    }
  }

  $('#comment-' + id + ' .comment-body').editable('http://www.example.com/save.php', options).trigger('click');
}

Which doesn't seem to work. I believe I need some way to reset() the form elements first.

from jquery_jeditable.

tuupola avatar tuupola commented on August 25, 2024

What are you trying to achieve? Why do you want to destroy Jeditable onblur?

from jquery_jeditable.

twig avatar twig commented on August 25, 2024

sorry I didnt explain myself.

i have an "edit" button which begins the editing process on another element (hence, the trigger).

when i am done editing (accept using the submit button), i want the edit ability to be removed.

i used onblur, but i changed it to be onreset and it is working fine now.
thanks!

from jquery_jeditable.

tuupola avatar tuupola commented on August 25, 2024

You do not need to do this by yourself. Jeditable goes back to normal (removes the form displays the new HTML) automatically after you click submit.

from jquery_jeditable.

twig avatar twig commented on August 25, 2024

yeah but the element becomes editable if i click on it
this is not something I want because I have links on it, and if i click on the link the edit form appears

from jquery_jeditable.

tuupola avatar tuupola commented on August 25, 2024

I guess you have some misunderstanding how Jeditable works. I say again. Jeditable closes the form and goes back to HTML automatically. You do NOT need to do it by yourself.

Also the way you trigger Jeditable inside comment_edit() function is quite unorthodox and un-jQuery way. Atleast to me.

More jQuerish would be binding Jeditable and trigger element on onload event. You can also bind using some custom event such as "edit" or "foo". Then when your trigger element is clicked just call .trigger("foo") on the edited element. This way when the edited element is clicked it will not become a form.

Here is one example: http://stackoverflow.com/questions/366595/jeditable-activate-edit-of-x-by-clicking-on-y

from jquery_jeditable.

twig avatar twig commented on August 25, 2024

No no, I do understand how it works, but as you said I am using it differently.

Thanks for that example, its exactly what I was after!

from jquery_jeditable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.