我不能使用jquery使span可编辑

时间:2022-09-12 08:55:52

I am uploading images with span text dynamically using javascript. It's uploading with span text perfectly but i am trying make that span editable using jquery code,

我正在使用javascript动态上传带有span文本的图像。它正在使用span文本完美上传,但我正在尝试使用jquery代码使该范围可编辑,

$('span').bind('dblclick',
  function(){
  $(this).attr('contentEditable',true);
  });

After uploading some images with span, making alignment using jquery gridly plugin.That code i m using,

上传一些带有span的图像后,使用jquery gridly插件进行对齐。我正在使用的代码,

$('.gridly').gridly({
   columns: 8
   // base: 60, // px 
   //gutter: 20 // px
   });
  $('.gridly').gridly('draggable');

        });

Here is my demo what i tired : http://jsfiddle.net/Manivasagam/72cr4bvk/8/

这是我的演示,我厌倦了:http://jsfiddle.net/Manivasagam/72cr4bvk/8/

I hope someone will correct my code and tell me why i can not edit span?

我希望有人会纠正我的代码并告诉我为什么我无法编辑跨度?

1 个解决方案

#1


2  

$('span').bind('dblclick', function() {
        $(this).attr('contentEditable', true);
    }).blur(
        function() {
            $(this).attr('contentEditable', false);
        });

and here is the working example

这是工作的例子

#1


2  

$('span').bind('dblclick', function() {
        $(this).attr('contentEditable', true);
    }).blur(
        function() {
            $(this).attr('contentEditable', false);
        });

and here is the working example

这是工作的例子