jQuery function in javascript loop -


i got div's i'm editing 'jeditable' works perfectly! want give users alert ask them if want edit post.

<script type="text/javascript" src="jquery-1.9.1.js"></script> <script type="text/javascript" src="jquery.jeditable.js"></script> <script type="text/javascript">  $(document).ready(function jeditable() {      $("div[title='article']").click (function() {         var edit;         edit = confirm("editing article?");          if (edit == true) {                          $('.edit').editable('x2.php', {                     cancel : 'cancel',                     submit : 'ok',                     onblur: 'ignore',                     });                       } else {                 alert("canceling edit..");             }      });       }); </script> 

1)when alert pops , cancel it, nothing happens (intended).

2)when click "ok" in alert nothing happens well.

3)when clicked "ok" once, function in 'if' works no matter if check "ok" or "cancel" in second click in alert.

i make text editable after user clicks "ok" once. (later on want make image clickable instead of text itself, because throws same error try solve way first)

please me. in advance

problem still alive! changed not make article clickable fo "confirm" img instead. way works perfectly, element trigger confirm make '.edit' editable. workaround found, still interested in solution other way :)

i looked @ jeditable library , therefore here achieve requirement

$(document).ready(function()     $("div[title='article']").click (function() {         if (confirm("editing article?")) {                          $('.edit').editable('x2.php', {                     cancel : 'cancel',                     submit : 'ok',                     onblur: 'ignore',                 });                   }            });      });  

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -