Skip to content Skip to sidebar Skip to footer

Jquery Passing ID From To Function

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 ] });

Solution 1:

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 ]
  });
}

Post a Comment for "Jquery Passing ID From To Function"