Prototype's activate function
Gives focus to a form control and selects its contents if it is a text input
according to the Prototype website. i.e.
$('my_element_id').activate();
What is the equivalent function in jQuery?
All objects have a prototype property. It is simply an object from which other objects can inherit properties. The snippet you have posted simply assigns an object with some properties (such as init ) to the prototype of jQuery , and aliases jQuery.prototype to jQuery.fn because fn is shorter and quicker to type.
fn is an alias for jQuery. prototype which allows you to extend jQuery with your own functions. For Example: $.fn.
The $() function The dollar function, $(), can be used as shorthand for the getElementById function. To refer to an element in the Document Object Model (DOM) of an HTML page, the usual function identifying an element is: document.
$('#my_element_id').focus();
which is a shortcut for
$('#my_element_id').trigger('focus');
http://api.jquery.com/focus/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With