I have encountered this solution for a problem I tried to solve (uncheck radio buttons), which works perfectly, but I can’t find anywhere on google what does .previous do and is it JS core or some library?
$('input[type=radio]').click(function(){
if (this.previous) {
this.checked = false;
}
this.previous = this.checked;
});
this is the original question
What you’ve quoted isn’t anything I’m familiar with. The
prevmethod is jQuery-specific. It gives you the previous sibling element. The DOM equivalent property ispreviousSibling(which may not be an Element, it may be a text node or something else).It looks there like someone’s creating an expando property on the element. I would strongly recommend against an expando property called
previous, but there you go.