Solved

Using jQuery livequery to highlight a table row

Posted on 2010-08-18
2
598 Views
Last Modified: 2012-06-21
I'm trying to highlight a row with jQuery and plugin livequery. I can do it fine if the table is loaded into the page initially, but if I try to dynamically load the table, the livequery is not working.

Is this possible? I've googled it but I don't see any examples doing what I need to do. Normally I would use the jQuery plugin flexigrid which handles it by binding the rows as they are appended but that is not what I want to do.

I want to be able to have a page loaded, click a link to display table data and onclick of the rows in that table, highlight the clicked row and remove the highlight from any previously clicked rows.

????
$('#tableid tbody tr ').livequery('click',function(e){
        
    ... take action here ...
        
});

Open in new window

0
Comment
Question by:Webspeeder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 16

Accepted Solution

by:
JF0 earned 250 total points
ID: 33467975
I am not familiar with livequery but based on your goal I would just use the build in jquery live function. The live function was specifically created to handle objects created on a page after it has loaded.

Reference:
http://api.jquery.com/live/

Usage:
$('.clickme').live('click', function() {
  // Live handler called.
});
0
 

Author Comment

by:Webspeeder
ID: 33468125
I've been using livequery for a long while now, maybe it was replaced by live. .live worked though.

Thanks for the info.
0

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

724 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question