Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...TIP: easily selecting any element using jQueryTIP: easily selecting any element using jQuery
Previous
 
Next
New Post
6/12/2014 1:54 PM
 

Some users have mentioned about DNN's multi layers of div's in the markup and the difficuly of using jQuery to select an element deep in the layer hierarchy. 

You can use the developer tools (F12)  and select any element in the page and use the 'copy css path' option in Firefox and Chrome (IE might have a similar option) and use it to easily construct the selector for jQuery.

Or the quick and dirty way is to name your element with a unique name you know won't be used but yourself and use a selector where id ends with your id. Example: a text input with id 'txtFirstName652' and use a jQuery selector like :$("input[id$='txtFirstName652']"). jQuery will find it anywhere in the page. Make sure it's not in a templated container like a gridview or repeater. Some might mention performance but we're talking about milliseconds which a human won't notice.


 

 

 
New Post
6/20/2014 10:37 PM
 
nice tip, thanks - you can do the same thing in the IE F12 tools (oddly enough this was better done in the "old" version, as in the new one you can't copy the path easily)

Buy the new Professional DNN7: Open Source .NET CMS Platform book Amazon US
 
Previous
 
Next
HomeHomeOur CommunityOur CommunityGeneral Discuss...General Discuss...TIP: easily selecting any element using jQueryTIP: easily selecting any element using jQuery


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out