How to link to specific anchor in table with jquery


I am using this jquery plugin:

<a href="http://www.jankoatwarpspeed.com/post/2009/07/20/Expand-table-rows-with-jQuery-jExpand-plugin.aspx" rel="nofollow">http://www.jankoatwarpspeed.com/post/2009/07/20/Expand-table-rows-with-jQuery-jExpand-plugin.aspx</a>

I have anchors in the code such as:

<a name="art" id="art2"></a> Articles

How can I open that particular row then? In other words, when a user clicks a link from another page to this landing page I would like the appropriate row to open up based on the anchor tag.

Thanks in advance!


In your document.ready you can call the click event of that anchor, like this:

$(function() { if(document.location.hash != '') $(document.location.hash).click(); });

This would make for example www.yoursite.com/yourPage.htm#art2 perform a click on that link causing it to open. Just make sure the above code is <strong>after</strong> your click event handler, so it actually does something on click :)

If you're landing on #art using the named anchor, similar approach:

$(function() { if(document.location.hash != '') $('a[name="' + document.location.hash.replace('#','') + '"]').click(); });


  • RCurl getURLContent detect content type through final redirect
  • How to restart a sketch project in processing?
  • Attribute value “001” of type ID must be an NCName when namespaces are enabled
  • how to create pretty urls
  • How do I get sikuli to wait until the mouse pointer changes from “busy” to “not busy?”
  • How to create a folder in the application installed directory
  • Google Apps Marketplace SDK install does not forward user to Setup URL
  • Play youtube video in offline mode?
  • jquery pie chart with drilldown/clickable pie parts
  • Eclipse RCP - Stacking a view with the editor area?
  • How to prompt user that edits have been made upon changing pages or sorting in Kendo Grid
  • JQM (jQueryMobile) Problem with AJAX content and focus()
  • help('modules') crashing? Not sure how to fix
  • Basic defensive programming [duplicate]
  • Entity Framework ObjectContext: Concurrency
  • Can XOR be expressed using SKI combinators?
  • Using MouseListener to select a range of cells in a grid
  • Dart - Isolate Cross Window Communication
  • PHP: When would you need the self:: keyword?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • Acquiring multiple attributes from .xml file in c#
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • embed rChart in Markdown
  • How to stop GridView from loading again when I press back button?
  • How to get Windows thread pool to call class member function?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Authorize attributes not working in MVC 4
  • How can I remove ASP.NET Designer.cs files?
  • Does armcc optimizes non-volatile variables with -O0?
  • Busy indicator not showing up in wpf window [duplicate]
  • costura.fody for a dll that references another dll
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?
  • Python/Django TangoWithDjango Models and Databases
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF