Forum Replies Created
-
AuthorPosts
-
Zac Gordon
KeymasterHi William!
Welcome 🙂 and don’t worry, in not too long you’ll forgot how much you didn’t know and be doing quite a lot with JS.
When we get to building complete JS themes then yes JS loops will replace PHP loops 🙂
However, if you have a normal PHP theme it will likely still run the Loop at the PHP level.
Hope that helps! Good question
Zac Gordon
KeymasterWell its also a good sign when it’s just little things like this causing problems 😉
Zac Gordon
KeymasterHey @Jason,
A few little tweaks, take a look at this and let me know if you can make sense of the differences. Small stuff:
var fieldsList = document.querySelector( '.fields' ), firstField = fieldsList.children[0], firstFieldInput = firstField.querySelector( 'input' ), firstFieldIdStr = firstFieldInput.getAttribute( 'id' ), firstFieldPlaceholder = firstFieldInput.getAttribute( 'placeholder' ), secondField = firstField.cloneNode( true ), secondFieldInput = secondField.querySelector( 'input' ), secondFieldLabel = secondField.querySelector( 'label' ), secondFieldIdStr = updateIdStr( firstFieldIdStr ), secondFieldPlaceholder = secondField.querySelector( 'input' ); secondFieldText = secondFieldLabel.innerText; console.log( secondFieldLabel ); secondFieldLabel.setAttribute( 'label', secondFieldIdStr ); secondFieldLabel.innerHTML = 'Field 2'; secondFieldInput.setAttribute( 'id', secondFieldIdStr ); secondFieldInput.setAttribute( 'name', secondFieldIdStr ); secondFieldLabel.setAttribute( 'for', secondFieldIdStr ); secondFieldPlaceholder.setAttribute( 'placeholder', 'Field 2 Text' ); fieldsList.appendChild( secondField ); function updateIdStr( value ) { var strArray = value.split( '-' ), id = strArray[ strArray.length - 1 ], newId = parseInt( id ) + 1; strArray[ strArray.length - 1 ] = newId; return strArray.toString().replace( ',' , '-' ); }
Zac Gordon
KeymasterHi folks, it looks like this was a little snafu due to some custom add to cart buttons and one page checkout being used together. The problem should be resolved now!
Zac Gordon
KeymasterHi Merrill,
This is a really good question.
What you are seeing here is a style of writing an init method that is not necessarily a best practice but is not uncommon.
The reason for this is mostly for readability and to keep the object declaration close to the initializing method for that object. There are not really technical difference between how init and the other methods are written and init could have been written in the same way as them and vice versa.
When I was building this project I did try to write things in a few different ways to expose us to things like this and you did a good job to bring it up here.
I could say more, but let me know if this answers your question for you 🙂
Sorry for the delay in response as well. Notifications plugin reactivated!
Zac
Zac Gordon
KeymasterGlad you got it sorted!
November 1, 2016 at 5:07 am in reply to: 1.3.05 Missing how to play with these in the console #14452Zac Gordon
KeymasterHi @Gillian!
I put together a little video here showing how you can set vars in the console. In this example I’m setting a variable based on an element in the DOM. You can pretty much do anything we do in these exercises in the console as well. [Sorry no sound]
Let me know if this doesn’t answer your question.
In terms of the actual suggestion for practice, I would say try to do some of the same things we do in the video, but just with different sites and types of DOM elements. Notice in this example we have a div with class of content but you will need to match classes, ids or other elements for other sites.
Hope that helps!
Zac
Zac Gordon
KeymasterOkay, great! Welcome 🙂
Zac Gordon
KeymasterHey Lucas!
You should have just got an email from me about this. The earlier problem mentioned was resolved, this is a little different, but please just shoot me a response to the email and we’ll get it all cleared up 🙂
Thanks!
ZacZac Gordon
KeymasterHi Folks,
My apologies, it looks like there was an issue tying the purchase to course access. It should be resolved now and you should all have access to available content!
Zac Gordon
KeymasterHey Jason! You should be all set now!
October 20, 2016 at 4:06 pm in reply to: 1.3.05 Missing how to play with these in the console #13150Zac Gordon
KeymasterHi Gillian,
See if this video helps 🙂
Should explain how to type multiple lines of code in the console.
Zac Gordon
KeymasterHi,
Yes, you are correct on catching this! There is actually a little note below the video pointing this out in case other folks notice the same thing. Sorry about that!
October 19, 2016 at 8:59 pm in reply to: 1.3.05 Missing how to play with these in the console #13119Zac Gordon
KeymasterHi!
You would want to do something like shift + enter for the line breaks to prevent it from executing one line at a time which won’t really be what you want.
You should also be able to paste code blocks into the console and have them work.
Zac Gordon
KeymasterOops! My bad! The lesson was up but not assigned to the right section. Sorry about that, you should be all set now!!! Congrats on your progress 😀
Zac Gordon
KeymasterHey Tim,
Sorry about these delays. I haven’t really been able to duplicate the issue, but I do have the ability to wipe quiz attempts which can sometimes help if you are not getting any results at all when taking the quiz. I’m wondering if it might be a simple cookie or cache issue that might need clearing on the computer with issues.
Sorry for the trouble, but glad you’re now on to Events!!!
Cheers 🙂
ZacZac Gordon
KeymasterDang, right you are Jason! Sorry about that, should be all set now!!!
Zac Gordon
KeymasterHi folks! Just wanted to let you know I just added a simple toggle sidebar feature 🙂 Hope it helps navigation a bit!
Zac Gordon
KeymasterHi Carme,
So sorry for the long delay, but I finally had a suggestion for how to fix it. Could you try taking the DOM Quiz again? It should hopefully show results for you this time.
Thanks!
ZacZac Gordon
KeymasterAh yes, I have had this request once before. Once I have some time I will add that functionality 🙂
Zac Gordon
KeymasterThanks Julie! Got it all fixed now 🙂
Zac Gordon
KeymasterHey James! Glad you found it 🙂
I am going to leave this thread open just in case any one else has the same problem, but if you like, let me know and I’ll delete it 😉
Zac Gordon
KeymasterHi Annette,
All of the code examples at the beginning of the course are available on JSBin, I do not have downloadable copies as well.
This is something I may be able to circle back and make available on Github, but it probably won’t be until more content is released since that is where all of my time is going at the moment.
Apologies for the inconvenience in the meantime.
Zac Gordon
KeymasterHey Vincent!
You completely got it 🙂 Your thought on the event starting at the target is quite common, but you are correct that the event starts at the document root and captures down first before bubbling back up from the event.
Glad you’ve got it now 🙂
Zac Gordon
KeymasterHey Silvan!
Yes, that would be a great feature, I will look into if it is something I could easily do..
Thanks!
-
AuthorPosts