You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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));
The text was updated successfully, but these errors were encountered:
I found a rouge article that said the .css() setter was instantaneous... and that worked... Still css properties are attributes of a tag... So the reader needs to know why this behavior is different than what was expected above.
The goal of the submission is to better the documentation... so don't bother and posting a solution unless you have a reason why the solution works and why the .attr fails to work.
The page you reference seems to be pretty clear about how to select elements. The document.getElementById() method only gets elements by their ID values as the name implies, and the first example shows a jQuery equivalent. Examples further down this page and on other pages show how to manipulate collections. For specific "why doesn't this work" questions a forum like StackOverflow can probably help.
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));
The text was updated successfully, but these errors were encountered: