Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts

jQuery Chaining Interview question

Which one of the following will break the chain and Why?
A-

$(…)
.html('Breaks chain')
.addClass('chainbreaker')

B-

$(…)
.html()
.addClass('chainbreaker')

Solution:
In A, .html('Breaks chain') behaves like a setter and returns object, on which .addClass(…) adds the given class. But in B, .html() behaves like a getter and returns a string, on which .addClass(…) methods fails to perform and gives runtime error.

Scheduling Repeating Local Notifications using Alarm Manager

Learn about Scheduling Repeating Local Notifications using Alarm Manager in this post .