I want to name this jQuery function like “showElements”. How can I do that?
$(function () {
$("#sortable").sortable({
revert: true
});
$("#draggable").draggable({
connectToSortable: "#sortable",
helper: "clone",
revert: "invalid"
});
$("ul, li").disableSelection();
});
As a jQuery plugin:
Use it like so:
$.showElements();As just a regular function:
Use it like so:
showElements();Fragile: you’re poluting the global scope