Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

422
Views
¿Cómo obtener el valor eq()?

es posible? ¿Para mí obtener el valor eq() ? Por ejemplo, si hago clic en li:eq(2) , var x se convertirá en 2 . Aquí está el código.

 $('#numbers ul li').click(function(){ x=$(this).eq().val(); alert(x); });
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

El .index() ¿qué es esto? el método lo hará.

 $('#numbers ul li').click(function() { var self = $(this), index = self.index(), text = self.text(); alert(text + ' ' + index); });

Demostración : http://www.jsfiddle.net/Y2aDP/

over 4 years ago · Santiago Trujillo Report

0

La respuesta anterior es incorrecta. Index proporciona un valor relativo con respecto a sus hermanos. Por lo tanto, se espera que el valor cambie.

debería ser algo como

 $('.someClass').click(function(){ var that_ = this; // your logic for this function .... .... var currentIndex = $('.someClass').index(_that); });
over 4 years ago · Santiago Trujillo Report

0

eq<> índice:

 scount=$(selector).length; for(i=0; i<scount; i++){ $("selector:eq("+i+")").attr("eq",i); } $("selector").click(function(){ alert($(this).attr("eq")); });
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!