Reputation:
i have a problem that i cant understand what to pass in the draagable function to make an elemnt draagable. I want to make my draggable through its id test. Can anyone tell me how to do this.
Code Sample
normal_tag11=' <div style="position:fixed" id="Normal_Tag1_div_dummy'+count1+'" class ="Normal_Tag1_div_dummy" >'+ 'Normal DUMMY</div>';
var id='Normal_Tag1_div_dummy'+count1; document.getElementById('droppable').innerHTML+=normal_tag11;
$('#id').draggable({ });
Upvotes: 2
Views: 1797
Reputation: 187110
$("#test").draggable();
if you are using jQueryui
$("#test")
selects your div element with id 'test'
In your code you have no element with id 'id'. Change your code
normal_tag11=' <div style="position:fixed" id="Normal_Tag1_div_dummy'+count1+'" class ="Normal_Tag1_div_dummy" >'+ 'Normal DUMMY</div>';
var id='#Normal_Tag1_div_dummy'+count1; document.getElementById('droppable').innerHTML+=normal_tag11;
$(id).draggable();
Upvotes: 1
Reputation: 2243
You don't need to pass any parameters to draggable().
Check that you're actually including a build of jQuery UI that includes draggable (draggable isn't part of jQuery proper).
Otherwise, look for other bugs in your code that may be preventing the line where draggable is called from being executed.
Regarding the code sample you added, if your intent is to select the element with an id as defined in the id variable (as opposed to the element with an id of "id", as you are currently selecting), you should be using:
$(id).draggable();
Upvotes: 1