Skip to content

documentation on selector #769

Closed
Closed
@dwkrueger2

Description

@dwkrueger2

learn.jquery.com/page/using-jquery-core/selecting-elements.md

it is unclear the relationship between the objects of jQuery and the javascript method document.getElementById()

I ran into this because I tried to change a simple attribute of a div... using the jQuery I was unsuccessful. I figured the objects might be the same or at least inherited property. So I checked and container1 is definitely different from container2...

Bottom line... the reader is likely to arrive at this page AFTER they have studied javascript and DOM. Therefore it would be nice to know the relationship between these jQuery Selectors and the getElementById() as provided by javascript.

As of writing this... I still haven't figured out why the attr setter is not working for container 1.. Is there a buffer flush or something?? Does it have to do with that dynamic vs static object concept??? I don't know it's not clear in the documentation... This page is more focused on the unique 'section' features than actually telling us what type of object it selects and returns.

/```
/ Hidden Elements initially
var form1 = $("#createSessionSignupForm").attr("display", "none");
alert("flag1");
var container1 = $("#loginBoxContainer").attr(
{
display: "none",
backgroundColor: "red"
});
alert("flag2");
var container2 = document.getElementById("loginBoxContainer").style.backgroundColor = "blue";
alert("flag3"+ (container1 === container2));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions