parent

get parentNode of clicked element in plain JS

两盒软妹~` 提交于 2019-12-06 01:34:04
问题 I need to get the parentNode of a clicked element in plain JS (no jQuery or other frameworks) I am currently using document.getElementById("item_click") but I want to change id="item_click" to class="item_click" so I can use multiple boxes. I just don't know how to integrate this in the script Here's a Fiddle <<< play with it HTML <div class="item"> <div class="item-tester" > <div class="item-icon"></div> <div class="item-title">Item Title</div> </div> <div id="item_click" onmousedown="new

Add another CSS Style to Child Elements which are also Parents

旧巷老猫 提交于 2019-12-05 20:28:20
So my list looks something like this: <div="list"> <ul> <li class="page item">Parent 1 <ul> <li class="page item">Child of Parent 1 and Parent of Grandchild <ul> <li class="page item">Grandchild</li> </ul> </li> </ul> </li> </ul> </div> This is through Wordpress' list_wp_pages along with a custom CSS suckerfish-like dropdown CSS code. Nothing can be changed in the unordered list itself, so I need to find a way to add a CSS style to only child pages that are also parents (Child of a Parent 1...). I've been trying to add an arrow icon only to child pages that have child pages of their own. I

Find parent and first child of it's parent

梦想与她 提交于 2019-12-05 16:41:48
问题 I am trying to find the parent of an element and it's parent first child, the code is like this: <ul class="lowerMenu"> <li><a href="" class="selected">Welcome</a></li> <li><a href="">Logo</a></li> <li><a href="">Websites</a></li> <li><a href="">Stationery</a></li> <li><a href="">Illustration</a></li> <li><a href="">Full Pack</a></li> </ul> function setIntervalAndExecute() { changeImages(); setTimeout(function(){ showImages(imagesArray); },500); var intervalot = window.setInterval(function(){

Getting the parent node attributes in XSL

こ雲淡風輕ζ 提交于 2019-12-05 13:04:24
问题 In my XML I have the following: <a> <b> <c something="false"> <d> <e> <f>someResult</f> </e> </d> </c> </b> </a> Now in the XSL within a loop I can do the following: <xsl:value-of select="f"></xsl:value-of> But how can I get the attribute in c? I've tried doing the following <xsl:value-of select="////@something"></xsl:value-of> As well as trying parent and nothing seems to be working. Can you get parent nodes like this? Also, I cannot just do: <xsl:value-of select="/a/b/c/@something"></xsl

C++ nested classes, access fathers variables [duplicate]

人盡茶涼 提交于 2019-12-05 11:02:06
This question already has an answer here: Can inner classes access private variables? 5 answers The title already says a lot, but basically what i want to do is the following(Example): I have a class called A, and another class inside a called B, like so: class A { int a; class B { void test() { a = 20; } }; }; As you can see my goal is for class B to have access to class A, as it is a nested class. Not this wont work, because B doesn't have access to A, but how can it get access? Thank You Despite that you declared class B inside of A, classes A and B are still completely independent. The

jquery - how to set parent attribute?

这一生的挚爱 提交于 2019-12-05 10:18:51
I'm trying to write an if statement where if one of the elements has it's display set to "none", I want the parent element to also display "none"... This is the code I'm trying, which doesn't work... /* tried this first */ if($('#prevx a').attr('display') == 'none') { $(this).parent().attr('display','none'); } /* and then this */ if($('#prevxa > a').attr('display') == 'none') { $('#prevxa').attr('display','none'); } The markup looks like this: <ul> <li class="navnext" id="nextxa"> <a id="nextx" href="#"><img src="/images/next.png"/></a> </li> <li class="navprev" id="prevxa"> <a id="prevx" href

Android: Making changes to a button's parent view

半世苍凉 提交于 2019-12-05 09:34:22
问题 I have a RelativeLayout with a button inside it. Once the user clicks on that button, I would like to change the background of the parent view (RelativeLayout). I know I can do this by storing the parent view in a variable or setting a tag on the button, but I'd lime to avoid that (I have very good reasons for not wanting this). Isn't there a way to just access the parent view from the button itself? 回答1: Try View.getParent(): Button yourBtn = (Button) findViewById(R.id.your_btn);

Css equivalent of :has() [duplicate]

跟風遠走 提交于 2019-12-05 08:02:29
This question already has an answer here: Is there a CSS parent selector? 31 answers In the following example: <div class="section"> <div class="row">...</div> <div class="row"> <- bottom margin here needs to be 0 -> <div class="section"> <div class="row">...</div> <div class="row">...</div> </div> </div> </div> .row { margin-bottom:10px; } If div .row is parent of div .section reset bottom margin to 0. I can do this with jquery, but is there a way to do it in css? At the moment there is no way in CSS to select the parent element of another element. However, in CSS4 there is the :has pseudo

Created File Has No Parent?

爱⌒轻易说出口 提交于 2019-12-05 01:42:32
In a java program, I create a file with File temp = new File("temp"); temp.createNewFile(); Then for some reason when I write File pDir = temp.getParentFile(); and pDir is null. I actually want to write File pDir = temp.getParentFile().getParentFile(); but that throws a null pointer exception. You need a file with a path for that, try getAbsoluteFile. File pDir = temp.getAbsoluteFile().getParentFile(); You're creating a file called temp, but it has no path, so there will be no parent path. If you want to put the file in the current directory: File temp = new File(System.getProperty("user.dir")

Set form as Parent throw exception “Top-level control cannot be added to a control”

余生长醉 提交于 2019-12-05 01:32:26
I want to access variables of a form from another form. On clicking a button inside my Main form, I want to set my Main form as Parent, then bring up another form (child form) wherein I will access variables of the Main form. My click handler is as follow: private void btnSystem_Click(object sender, EventArgs e) { Form_EnterPassword EP = new Form_EnterPassword(); EP.Parent = this; //error: Top-level control cannot be added to a control EP.ShowDialog(); } It compiles fine without any error. However, when I run the Main form and click on the System button, it throws me an exception. I do