English 中文(简体)
将(a)项和(b)项转让给动态制造的iv项
原标题:Assigning .draggable() and resizable() to dynamicaly created divs
  • 时间:2012-05-07 08:44:38
  •  标签:
  • jquery

昨天,我回答如何用不同的粗金来 d。 但是,这些残割必须具有可操作性和可再生性。 我这样做是用 j子做的,但我无法找到在下一部法典中加以执行的方法(因此,对于每部编造的 d来说,它需要双加起来。

var c = 0;
$( #add_txt ).on( click , function(){
    $( #vk_main ).append( <div id="vk_text_ + (c++) + ">TEST</div> );
});

因此,对于每一批“vk_text_some number”,必须分配属性: .draggable().resizable(); 。 我试图这样做,但所有我都不是真的。

最佳回答
var c = 0;
$( #add_txt ).on( click , function(){
    var $div = $( <div id="vk_text_ + (c++) + ">TEST +c+ </div> );
    $( #vk_main ).append($div);
    $div.draggable();
    $div.resizable();
});​
问题回答

您需要将“德拉戈夫”活动附在一页的负荷之后。 因此,你可以轻而易举地拖拉。 (我不知道你是在什么时候用点击方法。) 但是,你需要打上页装上的事件。

$(document).ready(function() 
{
var c = 0;
$( #add_txt ).on( click , function(){
    $( #vk_main ).append( <div id="vk_text_ + (c++) + ">TEST</div> );
    $( #vk_text_  + (c++)).draggable(); // (c++) is your random number which is concated with Div
});
}




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签