0

I'm trying to pass the id in the function. no idea how to do it... :/

    $(function Myfunction(this) {
        $(this.id).udraggable({
            grid: [ 15, 15 ]
        });
    });


<img onclick="Myfunction(this)" src="files/pic/Website.png" id="Website">
cyr
  • 1
  • 2

1 Answers1

2

1) pass this.id

<img onclick="Myfunction(this.id)" src="files/pic/Website.png" id="Website">

2) acess id in function

function Myfunction(id) {
  $("#"+id).udraggable({
      grid: [ 15, 15 ]
  });
}
Jayesh Chitroda
  • 4,987
  • 13
  • 18