Bug Tracker

Opened 11 years ago

Closed 11 years ago

#4689 closed bug (duplicate)

Can't select an input field inside a form

Reported by: pothibo Owned by:
Priority: major Milestone: 1.4
Component: unfiled Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:

Description

Here's the code, try to select the input inside.. I can't, I tried $('form[name="contact_add"] input[name="name"]') $('form[name="contact_add"] #name') $('form[name="contact_add"]').find('#name') and some more.. couldn't ever get my input selected.

$('form[name="contact_add"] input[name="name"]').livequery('keyup', function()

{

if (this.value.length > 3)

{

$('.field-loading').show(); $('#popup div.body div.results').load( FIXME: HARDCODED URL '/frontend_dev.php/contact/search', { query: this.value } );

$('#popup div.body div.results').ajaxComplete(function()

{

$('.field-loading').hide();

});

}

});

HTML

<form name="contact_add" method="post" action="/frontend_dev.php/contact/list">

<div class="field-wrapper">

<label>Search</label> <input type="text" id="name" class="field-input" name="name"/> <img src="/images/loading.gif" class="field-loading"/> </div>

<div class="notification"> </div> <div class="results"> </div>

</form>

Change History (2)

comment:1 Changed 11 years ago by pbcomm

I think this is a DOM issue. Form elements become properties of the form element and because you have an input with ID="name", it overwrites the original form property of "name" making it return an object of input.

Changing input ID and Name to something else would solve your immediate issue.

comment:2 Changed 11 years ago by dmethvin

Resolution: duplicate
Status: newclosed

This is a dup of #3685. See also this page:

http://yura.thinkweb2.com/domlint/

Note: See TracTickets for help on using tickets.