Hmm... note quit the right questions here.
$('#contents') returns a JQuery object. document.getElementById("contents") returns an HTML Dom object. So the above two statements are not the same.
What you possibly mean is $('#contents')[0] vs document.getElementById("contents");
What I would say is if you are going to utilize JQuery, obviously use the first. If not you may use the second - one less stop.
Any more advisable? If you are using JQuery, use the first. This way you can use JQuery methods.
More universal? You already answered - document.getElementById since the first you need JQuery. Don't know why you want to this though.
Less restricted? If you are using JQuery then $("#contents") is less restrictive.
You may get more input if you move this to the correct forum - JQuery forum, not JQuery Mobile forum.