Selecting An Element By Id
So I am new to jquery, I have been using Prototype. So far, loving jquery, but I have one bone to pick. Maybe I am doing something wrong, or there is a better way to do this, but I do alot of checking or selecting an element by id.
In prototype easy as: $("myTextBoxId")
Jquery makes this easy too: $("#myTextBoxId")
But jquery breaks doing: $("#myTextBoxId").value.length, it seems that everything is always returned as an array, so I must do: $("#myTextBoxId").get(0).value.length or $("#myTextBoxId")[0].value.length.
I guess it's just sort of annoying, since I am saying this is an id, there is only going to be a single/one element, so I should'nt need to say .get(0) or [0]. Is there a better way to do this? Thanks.