having a bit of trouble with jeditable plugin for jquery and was hoping someone wiser than myself can help.
Essentially I am trying to trigger the editable function on mouseover and submit any changes on mouse leave... sounds simple but the mouse leave bit doesnt seem very well documented :( This is kinda wha开发者_StackOverflowt I have so far:
$('.content').live("mouseenter", function() {
console.log("enter");
$('.editable', $(this)).editable(function(value, settings) {
//do stuff
});
}).live("mouseleave", function() {
console.log("leave");
$('.editable', $(this)).editable(function(value, settings) {
//stop doing stuff
});
})
So anyone have any idea how I submit the editable content and reset the content when mousing out? It only seems to work with a click :(
There is an onblur
option, which allows you to specify the behaviour when the element being edited is blurred. To achieve what you are after, you could specify onblur: 'submit'
, and on mouseleave
, you can make the element blur, e.g. $('.editable', this).blur()
.
I would use mouseover and mouseout as suggested in the jQuery documentation like so:
$(".hoverme").live("mouseover mouseout", function(event) {
if ( event.type == "mouseover" ) {
// do something on mouseover
} else {
// do something on mouseout
}
});
精彩评论