jquery - Draggable not working after append -
im having trouble making buttons draggable after append() through ajax call.
does see obvious error? thanks!
$(document).ready(function () { $("#exautotxt").keypress(function () { $.ajax({ url: '@url.action("exerciseautocomplete")', datatype: "json", data: { 'term': $("#exautotxt").val() }, datatype: "text", success: function (data) { var exarray = json.parse(data); $(".exresults").html(""); (var x = 0; x < exarray.length ; x++) { $(".exresults").append("<button class='exnamebtn btn'>" + exarray[x] + "</button> <br/> <br/>"); } $('.exnamebtn').draggable(); } }); }) });
buttons fire request on click default. need disable cancel: false
enable dragging:
$('.exnamebtn').draggable({cancel: false;});
Comments
Post a Comment