JQuery.select works, but Javascript.select doesnt

I am creating a mobile site for a Motorola / IE 6 device.

For some reason that I can't think of, the jQuery.select () function works, but there is no direct call to it in javascript.

<input type="text" id="lid" value="" class="as_done">

The jQuery method used is as follows:

$('#lid').select();

This method does not work:

document.getElementById('lid').select();

I am all at a loss. Any ideas as to why this is?

EDIT: I'm not trying to do anything in jQuery. I'm just trying to select text inside an input field. I don't need jQuery for this, but the standard way does not work. http://www.w3schools.com/jsref/met_text_select.asp

+3
source share
3 answers

. , Windows Mobile IE 6?

html:

<input type="hidden" id="lid_as" name="lid" value="1">
<input type="text" id="lid" value="" class="as_done">

alert("document.getElementById('lid').name"); lid. , , lid_as.

lid_as lid, select .

, HTML- :

<input type="text" id="lid" value="" class="as_done">
<input type="hidden" id="lid_as" name="lid" value="1">

, WINDOWS MOBILE IE 6.

+1

$() jquery, document.getElementById DOM.

+1

perhaps this is due to the fact that you did not call .focus () in advance

document.getElementById('lid').focus();
document.getElementById('lid').select();

it is wrapped in jQuerys.select ()

+1
source

All Articles