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

  • Home
  • SEARCH
  • 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 7493607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T17:05:06+00:00 2026-05-29T17:05:06+00:00

function addValidEvent(item,event,func) { if (item.addEventListener) { item.addEventListener(event, func, false); } else if (item.attachEvent) {

  • 0
function addValidEvent(item,event,func)
{
    if (item.addEventListener) 
    {
        item.addEventListener(event, func, false);        
    }
    else 
    if (item.attachEvent) 
    {
        item.attachEvent("on" + event, func);
    } else {
       //todo
    }
}

I call it like

addValidEvent(element, "mouseover", inRadio(element));

inRadio this is other function, I need to register this with out call a inRadio in addValidEvent call.

How to correct pass the function like param ?

  • 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-29T17:05:07+00:00Added an answer on May 29, 2026 at 5:05 pm

    The context on which your function is called is the element itself, so you could pass the function reference(name) as the event handler:

    addValidEvent(element, "mouseover", inRadio);
    

    or you can wrap your function call in an anonymous function(this might come in handy when you want to have more control over the callback) :

    addValidEvent(element, "mouseover", function(){inRadio(element);});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

function register_contact ($person = array()) { $nogood = false; foreach ($person as $val) {
function exporttoexcel() { $('#export').click(function() { $.ajax({ url: 'exportdata.aspx', cache: false, success: function(data) { }
function loaded() { document.addEventListener('touchmove', function(e){ e.preventDefault(); }); } loaded(); At certain times I want
function getLink($sa){ if($sa=='1'){ $sa = 'qp_bbl'; } else { $sa = 'qp_sbl'; } return
function valid() { begin_checked = false; end_checked = false; alert(begin_checked: +begin_checked); alert(end_checked: +end_checked); if
function test() { var flag1 = false; if ($('#field1').attr('value') || !$('#field1').attr('value')) { $.ajaxSetup({ cache:
function doSomething(e) { var targ; if (!e) var e = window.event; //<<<< what does
function someFunc() { return 'Hello, world'; } function call(funcName) { eval(funcName + '()'); }
function ff_chk_username_unique(element, action) { alert(element.value); alert(action); var actiona=http://localhost/myproject/check/check_username.php; var form_data = { username: element.value,
function countJSONObjByKeyValue(obj, key, value) { var countJSONShows = 0; $.each(obj, function(i, item) { if(obj[i].key

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.