Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7402363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:43:30+00:00 2026-05-29T04:43:30+00:00

i only know basic javascript and not even basic jquery, but i would like

  • 0

i only know basic javascript and not even basic jquery, but i would like to know something that is probably really trivial in jquery.

I would like a very simple example of how to create a function in a js file and execute that with a dom class parameter(like .sample) from my main script. Something like :

$('.sample').execute(200);

How would you go about writing this type of function in the jquery js file ? Simply put, i want an example to better understand how $() is used with jquery methods and how .sample is passed as a parameter to execute() and how it’s used in it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:43:31+00:00Added an answer on May 29, 2026 at 4:43 am

    If I’ve understood your question correctly you are basically asking how to write a jQuery plugin.

    The basic idea is this:

    (function($) {
        //$.fn is an alias for $.prototype
        $.fn.execute = function(someParam) {
            //"this" refers to jQuery object on which method has been called
        };
    })(jQuery); //Pass jQuery to anonymous function so we don't overwrite $
    

    This can then be called as you showed in your question:

    $("someSelector").execute(whatever);
    

    You can learn alot more on the jQuery Plugin Authoring page. If you want to actually understand what the above code means, and what actually happens, it’s probably worth getting to grips with JavaScript before looking at jQuery.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I only know a few basic things in JavaScript, so I need some help
I only know that the difference between hashmap and map is that hashmap is
I want to do some sophisticated animations. But I only know how to animate
I need to read a file in PHP, but I only know the end
Is there a ActionScript-version of JavaScript's Canvas.clearRect()? I only know graphics.drawRect(...) which allows me
I have only the most basic knowledge of web scripting, but i'm trying to
I have never done any testing in javascript. I know, I know. But the
Every programming language I know (Perl, Javascript, PHP, Python, ASP, ActionScript, Commodore Basic) uses
I only have very basic knowledge on Javascript and I want to be able
( I know this is probably a simple question to answer, but I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.