Bug Tracker

Modify

Ticket #4689 (closed bug: duplicate)

Opened 4 years ago

Last modified 4 years ago

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:
Blocking: Blocked by:

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

comment:1 Changed 4 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 4 years ago by dmethvin

  • Status changed from new to closed
  • Resolution set to duplicate

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

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

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.