Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8914799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:49:05+00:00 2026-06-15T04:49:05+00:00

If your prepend a FORM element with a P element, elements below the DIV

  • 0

If your prepend a FORM element with a P element, elements below the DIV in the example will not be selected!

<P><FORM id=f ...
<INPUT ...>
<DIV><INPUT (this element is not selectable)
</DIV>
</FORM>

No $('#f INPUT').events will happen in IE for the second input above
Try the testcase at: http://jsfiddle.net/jorese/Bzc7M/

In IE you will receive an alert=3, remove the P element in front of the FORM element and you get the expected alert=5. In Chrome|FF you get alert=5 as expected.

Can somebody explain this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T04:49:07+00:00Added an answer on June 15, 2026 at 4:49 am

    Your HTML code is not valid, it contains a few errors, the reason why some browsers render it is that they tolerate invalid code to some extent by trying to guess what the developer originally wanted to write.

    The div element can be used to group almost any elements together. Indeed, it can contain almost any other element, unlike p, which can only contain inline elements.

    Use div instead:
    http://jsfiddle.net/mshMX/

    Sitepoint reference: http://reference.sitepoint.com/html/p

    W3 reference http://www.w3.org/TR/html4/sgml/dtd.html

    A former StackOverflow question about the same problem: Why <p> tag can't contain <div> tag inside it?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is my html form <div id=create> <form action=index.php method=get id=createform> <input type=text name=urlbox
With your help I could take the input from a text file (input.txt) where
This is a very simple form that I have found on the web (as
Using this example . Pretend there are date fields in both forms. How would
Using Twitter's Bootstrap, I have a form with an input field and a prepended
i'm trying to add input dynamicly for this I take the actual HTML of
I get a script that creates a form with an input file after clicking
Hallo, I would appreciate your advice. Given the following snippet: <div id=parent><div id=child>ChildText<span id=subchildtext><b>SubChildText</b></span></div></div>
Your job is to design a Project Plan class library which supports the tracking
Your task, should you choose to accept it, is to write a Perl regular

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.