1
I have several divs
with the same class and need a function that when I pass the mouse on any of them, with mouseover()
get her index
1
I have several divs
with the same class and need a function that when I pass the mouse on any of them, with mouseover()
get her index
3
When you say position eq()
would be the index of the element?
If so, you can use .index()
$(element).mouseover(function(){
alert($(this).index());
});
I created a little example, if that’s it:
$(function(){
$("div").mouseover(function(e){
console.log($(this).index());
});
});
div {
width: 60px;
height: 60px;
margin: 10px;
float: left;
border: 2px solid blue;
}
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
Exactly Leonardo, that’s what I needed! Thank you very much!!
@Gustavosantana, mark the answers that helped. Do not abandon the questions.
Browser other questions tagged jquery
You are not signed in. Login or sign up in order to post.
It helps if you show the code...
– ShutUpMagda
Thank you for your attention, I have already received an answer
– user64576
Mark the answer then. Don’t leave the question open.
– ShutUpMagda
The guy who answered that did magic, I keep thinking that this question is low quality.
– MoshMage