CodeIgniter Forums
jQuery Inline Edit - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: jQuery Inline Edit (/showthread.php?tid=40076)



jQuery Inline Edit - El Forum - 03-29-2011

[eluser]Total Shop UK[/eluser]
I'm trying to get the QuickEdit code below to work with IE...it works fine with FF.

Anyone able to help?

Code:
<ѕcript type="text/javascript">
(function($) {
$.fn.inlineEdit = function(options) {
    options = $.extend({
        hoverClass: 'hover'
    }, options);
    return $.each(this, function() {
        var self = $(this);
        var id = $(this).attr('id');
        self.value = self.text();
        self.bind('click', function() {
            self
                .html('&lt;input type="text" id="'+ id +'" value="'+ self.value +'"&gt;')        
                .find('input')
                .bind('blur', function(event) {
                    $.post("/_ajax/quick_save",{
                        id: $(this).attr('id'),
                        value: $(this).val()
                    });
                    self.value = $(this).val();
                    self.text(self.value);
                })
                .focus();
            })
            .hover(
                function(){
                    self.addClass(options.hoverClass);
                },
                function(){
                    self.removeClass(options.hoverClass);
                }
            );
        });
    }
})(jQuery);
$(function(){
    $('.editable').inlineEdit();
});
</ѕcript>

Code:
<span id="policy_code" class="editable">DP-001<span>