JavaScript mechanism for holding onto a value from a user action

I've created a JavaScript object to hold onto a value set by a user checking a checbox in a [ColorBox][1]. I am relatively new to jQuery and programming JavaScript "the right way" and wanted to be sure that the below mechanism for capturing the users *check action* was a best practice for JavaScript in general. Further, since I am employing jQuery is there a simpler method to hold onto their action that I should be utilizing? function Check() { this.Checked = false; } obj = new Check; $(document).ready(function() { $('.cboxelement').colorbox({ html: ' ' }); $(document).bind('cbox_cleanup', function() { obj.Checked = $.fn.colorbox.getContent().children('#inactivate').is(':checked'); }); $(document).bind('cbox_closed', function() { if ($($.fn.colorbox.element()).attr('id').match('Remove') && obj.Checked) { var row = $($.fn.colorbox.element()).parents('tr'); row.fadeOut(1000, function() { row.remove(); }); } }); }); [1]:

以上就是JavaScript mechanism for holding onto a value from a user action的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准