More jQuery and RWD
Since the 301 course here at Code Fellows covers a lot of jQuery, I get the feeling I will be writing about it quite a bit. That’s ok though given that writing is suppose to help me learn it better.
To remain true to my first post, I am trying to follow these three questions when writing a post:
- What is one interesting piece of code I have learned since the last post and why?
- What do I feel I have improved upon since the last post?
- What is one thing I want to learn more about before the next post?
So I think the most interesting piece of code I’ve come across this last week is probably the ‘attr’ method in jQuery:
The fascinating use we were taught this week was actually attaching an attribute to the element, then later referencing that element by the attribute you attach. For example:
$('#specificSection div').attr('data-category', 'some value');
This will select the div within a ‘specificSection’ element (assuming it’s the only div, or it will give you an array). This gives the element an attribute it didn’t previously have:
<div data-category="some value"></div>
Then later you can access this element programmatically with the use of that attribute:
2. What have I improved upon since the last post?
Well I have definitely improved on my understanding of css selectors and jQuery specific selectors. I also feel I have improved on my understanding of clean code and writing code with clear notes.
3. Something I want to learn more about:
Definitely want to learn more about working on a team. We have been pair programming in this class but sometimes its impossible to explain something to someone that doesn’t understand the basics of their own computer. Quite frustrating, even as I am told that I am one of the most patient people, it’s really frustrating.