Rich-text Reply

Get Element Doom Path function

mubbashar 05-02-16

Get Element Doom Path function

Hi All,

Can somebody tell to  get element doom path using jquery or javascript.

thanks!

JasonDahlin 05-02-16
 

Re: Get Element Doom Path function

@mubbashar - There are lots of tutorials and references on the internet on how to use jQuery selectors.  The message boards are a decent place to help you find one specific jQuery selector if you have a specific page, but this is probably not a good place to try to learn it all.

 

Check w3schools for a good reference on how jQuery selectors work.

http://www.w3schools.com/jquery/jquery_ref_selectors.asp

 

The most important ones are at the top - these are the ones you will use most often and ar ethe building blocks for more selective finding methods:

#id$("#lastname")The element with id="lastname"
.class$(".intro")All elements with class="intro"

 

Suppose you have a button on your page that you want to locate.  If that button has an id on it like this:

<button class="theButton">Push Me</button>

You would find that button using jQuery like this:

jQuery(".theButton")
or
$(".theButton")

 

If your page has "theButton" on it more than once, and you only want to find one of them, you need to be a but more precise in yoru jQuery selectors... perhaps the button appears on the page like this:

<div id="first_topic">
	<p>Some text and then a <button class="theButton">Push Me</button></p>
</div>

<div id="second_topic">
	<p>Some text and then a <button class="theButton">Push Me</button></p>
</div>

If you want to find only the second button, your jQuery selector could look like this:

jQuery("#second_topic .theButton")

 

--Jason Dahlin
Analytics and Testing Guru Smiley Happy
mubbashar 06-27-16
 

Re: Get Element Doom Path function

Is Optimizely using any javascript libraray for finding the the dompath of the element. Can you refer to that please as optimzely generate very optimize path.

thanks

JasonDahlin 06-28-16
 

Re: Get Element Doom Path function

Are you asking how the WYSIWIG editor determines what selectors to use in the jQuery that it creates when you build your expierment?

--Jason Dahlin
Analytics and Testing Guru Smiley Happy