jQuery: The Write Less, Do More JavaScript Library

How to do a document.getElementById("mytextbo").select() in jquery?

View: New views
3 Messages — Rating Filter:   Alert me  

How to do a document.getElementById("mytextbo").select() in jquery?

by eric.advincula :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I've been searching and i'm not quite sure how to do it.  Anyone else
know how? Thanks

Re: How to do a document.getElementById("mytextbo").select() in jquery?

by Karl Rudd :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


$("#mytextbo")[0].select();

jQuery(selectorString), or the "shortcut" $(selectorString), always
return an array like object. To "run" the select() on it you have to
access one of the "raw" elements it contains, hence the [0], which
retrieves the first element in the "array".

Karl Rudd

On Tue, May 13, 2008 at 12:19 PM,  <eric.advincula@...> wrote:
>
>  I've been searching and i'm not quite sure how to do it.  Anyone else
>  know how? Thanks

Re: How to do a document.getElementById("mytextbo").select() in jquery?

by eric.advincula :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Thanks you, I will give this a try

On May 12, 7:42 pm, "Karl Rudd" <karl.r...@...> wrote:

> $("#mytextbo")[0].select();
>
> jQuery(selectorString), or the "shortcut" $(selectorString), always
> return an array like object. To "run" the select() on it you have to
> access one of the "raw" elements it contains, hence the [0], which
> retrieves the first element in the "array".
>
> Karl Rudd
>
> On Tue, May 13, 2008 at 12:19 PM,  <eric.advinc...@...> wrote:
>
> >  I've been searching and i'm not quite sure how to do it.  Anyone else
> >  know how? Thanks