2 problems with this code:
console.log($('idiv').id);
first is you are using an invalid selector
$('idiv') is looking for html tagname= 'idiv'
Your html doesn't reflect anything with "idiv" in it so really not sure what you are trying to select with it
Next is to use ".id" you need the native DOM node not the jQuery object for the DOM node
Equivalent jQuery method is
$(selector).attr('id')
Or to return native DOM node from jQuery object there are several ways
$(selector)[0].id
$(selector).get(0).id
Within a jQuery method "this" is the native DOM node which is why plugin code can utilize this.id