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 8885753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T21:23:14+00:00 2026-06-14T21:23:14+00:00

I have a sample code: <a href=></a> <textarea></textarea> <object></object> <img src= /> <div id=content></div>

  • 0

I have a sample code:

<a href=""></a>
<textarea></textarea>
<object></object>
<img src="" />
<div id="content"></div>

I had using this:

jQuery("a").mouseover(function() {
    alert();
 });
 jQuery("textarea").mouseover(function() {
    alert();
 });
 jQuery("object").mouseover(function() {
    alert();
 }); 
 jQuery("img").mouseover(function() {
    alert();
 });
 jQuery("#content").mouseover(function() {
    alert();
 });

Can I using this ?

var object = ["a","textarea","object","img", "content"]; 
jQuery.each(object, function() {
   jQuery(this).mouseover(function(){
      alert();
   });  
});

How to ideas using jQuery mouseover from an array ?

  • 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-06-14T21:23:15+00:00Added an answer on June 14, 2026 at 9:23 pm

    In the context of your .each() loop, this will be the current element from the array, i.e., a string, except that each string will be wrapped in an object (as explained at the $.each() doco page), so you need to use this.toString():

    jQuery(this.toString()).mouseover(function(){
    

    …and then it will have the same effect as jQuery("a"), jQuery("textarea") and so forth. Which will work as long as each string is a valid selector. Or, better, make use of the arguments that jQuery passes to your function:

    jQuery.each(object, function(i, val) {
       jQuery(val).mouseover(function(){
    

    The final element in your array is an id, so it needs a #:

    var object = ["a","textarea","object","img", "#content"];
    // add # here --------------------------------^
    

    Then in the context of the mouseover handler, this is the element that the event occurred on, so just use jQuery(this) rather than jQuery("#" + this). Putting that all together:

    jQuery.each(object, function(i, val) {
       jQuery(val).mouseover(function(){
           jQuery(this).css(...);           
       });  
    });​
    

    Demo: http://jsfiddle.net/GBtFY/

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

Sidebar

Related Questions

I have this in my code: <a href = res/pdf/sample.pdf>Sample PDF</a> So basically it
I have this sample code: DirectoryEntry _entry = new DirectoryEntry( connectionString, this.userPrinicipalName, this.password, AuthenticationTypes.SecureSocketsLayer
I have this sample code for async operations (copied from the interwebs) public class
Say I have this sample code I'm writing for a Python lesson I'm holding:
When I have download sample code from this link and than try to build
I have the below sample code for a navigation list: <div id=menu> <ul> <li><a
I have this code sample (written by someone else) that parses the website, and
I have a sample code: <a title=click href=test.swf class=game-in-link style=background:#000;width:100%;height:450px;display:block;>CLICK ON PLAY</a> <div> <!--
I have created a sample web application using jQuery Mobile. I have created two
How do I pass this.href from asp.net code behind? Here is what I have,

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.