javascript - Jquery Checkbox custom event does not return stable result -


hi i'm working on custom blogsite have working script here checkbox. checkbox not have attrib checked default because page displays first actual article checkbox labeled "edit" when user clicks on article loaded on textarea(it has tinymce plugin editing purpose) user can edit article.. used check if editing fyi

here script:

$("#edit").on('change', function(e){         $("#viewmode").toggle(function(){                     $.ajax({               type: 'get',               url: 'includes/edittyp.php',               data: "flag="+0,               success: function (status) { }                 });         });         $("#viewmode").toggleclass('display: none' );         $("#editmode").toggle(function(){                  $.ajax({               type: 'get',               url: 'includes/edittyp.php',               data: "flag="+1,               success: function (status) { }                 });         });         $("#editmode").toggleclass('display: block' ); 

my issue script updates flag 1 whenever $("#editmode") toggled , updates 0 whenever $("#viewmode") clicked works once because after refreshed page viewmode returns 1 , editmode returns 0 or not change @ all.. can please point out did go wrong or there other way/s on how can achieve this

thanks


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -