w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Is there a universal css3 selector like ">*" to style every child element inside that parent?
Your code (.option2 ul li div > *) doesn't work because the lists themselves have no borders, but the list items do. Thus, .option2 ul li div ul > * would work, but moreover, even specifying .option2 ul li * would target any element nested within a list item of the option2 list. .option2 ul li { border-bottom: 1px solid black; } .option2 ul li * { border: none; } //removes border on nested elements of any kind

Categories : HTML

Assigning a jQuery selector for lots of divs
Classes should not slow performance dramatically. They only overhead is the time it takes to read over the fact that it has a class which is practically nothing. Actions that actually take processing power only occur when changes are made to the div. This is going to happen regardless of how you set up the click listener.

Categories : Jquery

Assigning value for a control which is in child page
If you are sure you won't run into conflicting ids, depending on your framework version, most simple way is setting ClientIDMode="Static" on your label. Your code should then work. If not sure, you may set a (unique) utility cssclass of 'timerLabel' on your label, then in your function : document.getElementsByClassName("timerLabel")[0].innerHTML = "Time Left : " + mins + " : " + secs;

Categories : Javascript

Polymorphism:Assigning child class to superclass
The first two are identical in effect. Casting is unnecessary. If you want the map to contain a mixture of child classes, you need to declare Map<String,Parent> If you declare Map<String,T extends Parent> it declares a map from String to one particular child class of type T. The type parameter will need to be specified elsewhere (as a type parameter to the containing class or to an enclosing method). Note that you cannot instantiate a Map of an unbound type. Thus, for instance: Map<String,? extends Parent> = new HashMap<String, ? extends Parent>(); generates a compiler error. The best you could do is: Map<String,? extends Parent> = new HashMap<String, Parent>(); in which case you might as well stick with Map<String,Parent> = new HashM

Categories : Java

CSS Selector "If it has this child"
$('.k-widget>#window_Monthly').parent() in case the child is not a first-level descendant: $('.k-widget #window_Monthly').parents('.k-widget')

Categories : Javascript

CSS :not(li>:first-child) selector
I'm a bit confused, but in cases where I want a first-child to have a different style, I actually give it's siblings the desired alternative style: li { color:#00f; } li + li { color:#f00; }

Categories : CSS

Nth child selector
It's a little tricky to determine the big picture or exactly what you want it to look like. But I bet something like this might get you started: .mh-menu li:hover:nth-child(2) img { top: 70px; } OR...just remove the "top" declaration from the rule you have with this (?): .mh-menu li img {...}

Categories : HTML

css selector for many child tags
No, there isn't anything like this. In addition, you're overqualifing your selectors and this lead to poor performance. If you want to use a more expressive language to write your CSS, use SCSS instead.

Categories : CSS

:nth-child(even/odd) selector with class
In general what you want is not possible, but there is a way to achieve the desired behavior for limited numbers of "excluded" elements: the general sibling combinator ~. The idea is that for each occurrence of a non-.parent element subsequent .parent elements will have their colors toggled: .parent:nth-child(odd) { background-color: green; } .parent:nth-child(even) { background-color: red; } /* after the first non-.parent, toggle colors */ li:not(.parent) ~ .parent:nth-child(odd) { background-color: red; } li:not(.parent) ~ .parent:nth-child(even) { background-color: green; } /* after the second non-.parent, toggle again */ li:not(.parent) ~ li:not(.parent) ~ .parent:nth-child(odd) { background-color: green; } li:not(.parent) ~ li:not(.parent) ~ .parent:nth-child(e

Categories : HTML

nth-child selector replacement in IE
No; unfortunately you have to tag each row manually with a class to replace :nth-child(odd). You can replace :nth-child(1) with :first-child though, assuming you're supporting something like IE7 or IE8 and not an extremely old version.

Categories : Javascript

CSS selector: first child of parent
I'd suggest, if you want to match the first h1 of a parent element (in compliant browsers) using :first-of-type: h1:first-of-type { /* CSS to style the first h1 of its parent element */ } If, however, you want to style a h1 element only if it's the first child of its parent: h1:first-child { /* CSS to style the h1 only if it's the first-child of its parent element */ }

Categories : CSS

JQuery CSS nth-child selector
This is because the VOD item is the first child of its parent, therefore receives the colour. It does not take into consideration other elements around it. However, your jQuery selector is considering ALL list items on the page as one big group, so it alternates colours no matter where they are in the DOM.

Categories : Jquery

CSS first-child selector not working on most elements
It helps if your Fiddle and your posted code are the same. first-child only matches the first element. The first child of the .container_principal is the .header, therefore .container_principal .continut:first-child will never match. Try wrapping your .continut elements in another <div>

Categories : Jquery

issue with 'first-child' selector in jquery
#car :first-child selects every element that is a first child of anything within the #car element. To select only the first <li> use this instead: $('#car > :first-child').addClass('hori'); The > will make sure only to select a direct descendant of #car. Of course, you don't really need jQuery as this can be done in CSS as well.

Categories : Jquery

How to work with CSS Child Selector in a List?
<ul class="level1"> <li>Level 1</li> <li>Level 1</li> <li>Level 1 // Started here because of this <ul class="level2"> // class2 ul elements are considered as li of class1 <li>Level 2</li> <li>Level 2</li> </ul> </li> <li>Level 1</li> </ul> whereas here, your second question, I would like to add @defau1t answer : In short, it is impossible toplace a <div> element inside a <p> in the DOM because the opening <div> tag will automatically close the <p> element. <div class="level1"> <p>Level 1</p> <p>Level 1</p> <p>Level 1 //P tag can't hav

Categories : HTML

CSS Child Selector (>) not working with certain properties
try this Demo <ul> <li>Item 1</li> <li> <ol> <li>Subitem 2A</li> <li>Subitem 2B</li> </ol> </li> </ul> css ul > li { color:#F00; } ul > li > ol > li { color:#000; }

Categories : HTML

Why does the nth-child selector select these elements?
* > ul li:nth-child(4n+3) Firstly, the * > at the start of this selector is entirely redundant (It tells the browser to look for a ul that is a child of something else; anything else. Which of course all ul elements are; if nothing else, they'll be inside the body tag). So you can remove that. It'll make it simpler to work with and easier to explain. Now we're left with this: ul li:nth-child(4n+3) The reason it's picking both 2.3 and 3 is because both your sets of li elements are descended from the single parent ul element. Using a space between selectors tells the browser to look for any descendants that match; it doesn't care about how far down the tree to look for matching li elements, so it finds both sets. To answer your question about why 2.3 isn't seen as the seventh e

Categories : HTML

CSS Selector for Child of Sibling Element
No. You cannot achieve this using CSS only. Javascript is a good option in this case.. You can however detect the .parent being hovered (which will solve your problem if the parent surrounds exactly the trigger): .parent:hover + .sibling div#change{background:red;} (markup stays the same jsFiddle)

Categories : HTML

Selector issues - how to select nth child
Try: $('#mainmenu a').eq(2).click(function() {}); or: $('#mainmenu a:eq(2)').click(function() {}); Indexing starts at 0, so 2 == third element.

Categories : Jquery

jquery animation on child of this selector
This is short and also should work: jQuery(document).ready(function () { jQuery(".jcarousel-skin-tango li").mouseenter(function () { jQuery("img" , this).animate({ top: '10px' }, 2000); }); JSFiddle: http://jsfiddle.net/7H7y9/1/

Categories : Jquery

“:nth-of-type() or nth-child()” Selector work for IE 9?
It does work with CSS3-Pseudoselectors.-> See Does selenium not support CSS3 Selectors? Please show the specific code

Categories : Internet Explorer

jQuery child selector not working as expected
You have two parent divs with the same class. Change your HTML to this to get the behavior you want: <div class=widget1> <div class=panel>panel1</div> <div class=panel>panel2 <div class=widget2> <div class=panel>panel1</div> <div class=panel>panel2</div> </div> </div> </div> And your script to this: var panels = $("div.widget1 > .panel"); alert(panels.length); // returns 2 var panels = $("div.widget2").children(".panel"); alert(panels.length); // returns 2 (demo)

Categories : Jquery

Do parent selectors take precedence over child selector in CSS?
You should read up on specificity. To answer your immediate question, all your selectors carry the same specificity, so in the case of .green, the last rule takes precedence: your border would be blue.

Categories : CSS

Why is this nth-child pseudo selector not working in the following table?
I know that @Musa teased out a solution to this problem, but I will add to that just to document in case others run into this issue. As of right now you can't segment sections of siblings via classes AND use :nth-child(). //Standard Use: ul li:nth-child(2) { color: #0cf; } <ul> <li>One</li> <li>Two</li> <!-- Highlights Two --> <li>Three</li> </ul> // Attempted Use: ul li.scope:nth-child(2) { color: #0cf; } <ul> <li>One</li> <li>Two</li> <li>Three</li> <li class="scope">One</li> <li class="scope">Two</li> <!-- Fails --> <li class="scope

Categories : CSS

Can't get the ":last-child" selector to work on my layout. What am I missing?
Your problem is that the last .posts-wrapper div you have is NOT the last child of its parent. You have the <nav> element as a sibling after it. As you're already using CSS3 selectors, you can try the :last-of-type pseudo-selector to get the last .posts-wrapper element. .posts-wrapper:last-of-type { margin-bottom:0; padding-bottom:66px; border-bottom:0; }

Categories : HTML

jQuery's Less Than Selector, Treating Each Child Differently
Firstly there should be no gap between the selector where you specify the index $('#alpha > .bet.gimmel > div:lt(6)') While iterating over the elements using $.each use the index that is passed to the function $('#alpha > .bet.gimmel > div:lt(6)').each(function(i) { if(i ===0) { /// do something } else if (i ===1 ) { /// do something else } ... ... }); Update Looks like a syntax error to me else { $(this).text(); } } < -- End of each } < -- En of function Supposed to be else { $(this).text(); } }); < -- End of each } < -- En of function

Categories : Javascript

JQuery .click() selector ignore child elements?
You could use: $("div").click(function (e) { if (e.target.nodeName.toLowerCase() != 'a') alert("hello world"); }); jsFiddle example

Categories : Jquery

JQuery selector: Select elements without an iframe as a child
You can use combination of :not and :has Live Demo $("div:not(:has(iframe))").remove();

Categories : Jquery

Why is my first-child selector not working on the first element in a selection with a specified class?
:first-child matches the first child of its parent. Your first a.trigger is not the first child — that would be the classless a before it. :first-of-type and :nth-of-type(1), which are equivalent, match the first element of its type within its parent. In this case, your classless a is also the first a of its parent, making your first a.trigger the second a element. Is your given structure how your dynamic element will always be generated? If so, you can simply select a.trigger:nth-child(2) instead of a.trigger:first-child: .ui-collapsible-tabs.ui-dynamic-tabs .ui-collapsible-heading a.trigger:nth-child(2) { right: 0; background-color: red !important; border-right: 1px solid red; } Or you can try a + a.trigger: .ui-collapsible-tabs.ui-dynamic-tabs .ui-collapsible-heading a + a

Categories : HTML

Using css child selector in ruby selenium-webdriver element find_elements
As you don't give the page url,I took this Chinese language.Now I tried to find out the table column values for the second row of the first table having class name "wikitable sortable. require 'selenium-webdriver' driver = Selenium::WebDriver.for :firefox driver.navigate.to "http://en.wikipedia.org/wiki/Chinese_language" table = driver.find_element(:css,"table.wikitable") # !> assigned but unused variable - table tb_col = driver.find_elements(:css,"tr:nth-of-type(2)>td") tb_col[0..5].each{|e| p e.text} # >> "汉语/漢語 or 中文 Hànyǔ or Zhōngwén" # >> "汉语" # >> "中文" # >> "Wu Notes: includes Shanghainese" # >> "Wu; 吴/吳" # >> "Wúyǔ" The way you tried table.find_elements(:css, '> tbody > tr') is not valid css syntax

Categories : CSS

Does universal selector (*) in combination with :last-child work in all mobile browsers?
Prepending the universal selector is unnecessary in this case, since not specifying a selector before :last-child will still allow it to target any element that is a last-child within a parent. The :last-child pseudo-class is also well supported among mobile browsers according to caniuse. Instead just use: #my-container > :last-child { /* my styles */ } http://jsfiddle.net/utEUw/4/

Categories : CSS

How to find elements when child element exists or not with JQuery selector?
You don't need Jquery for do this. Just with CSS selectors you can do it: DEMO Here is the CSS selector: .container > div.zone img, .container > div.zone img[alt="GG"] { background: red; } Cheers, Leo!

Categories : Jquery

CSS selector to check an attribute of a child div and style based on the result?
No, you cannot.. yet. The CSS4 Selectors Spec shows a way to choose the subject of a rule, but it is not implemented in any browsers. To note, hopefully you will be able to do this soon (from the spec) For example, the following selector represents a list item LI unique child of an ordered list OL: OL > LI:only-child However the following one represents an ordered list OL having a unique child, that child being a LI: !OL > LI:only-child

Categories : HTML

why CSS direct child selector applies style to indirect children
All else being equal, the default style for the span will be: span { color: inherit; } So, while the rule color: red; won't apply to it directly, it will take its color from the parent element's color. For comparison, see what happens if you explicitly say span { color: blue; }.

Categories : HTML

Assigning a variable inside an array
Brute force method will work... $customFields = array( array( "name" => "ContactPerson-name", "title" => "Contact Name", "description" => "... of {CONTACT_PERSON} will be used...", "type" => "textinput", "scope" => array( "page" ), "capability" => "edit_pages" ) ); $contact_person = get_option('contact_person'); foreach($customFields as &$field) { $field['description'] = str_replace("{CONTACT_PERSON}", $contact_person, $field['description']); } unset($field);

Categories : PHP

Value not assigning inside select tag using javascript
I'd suggest to use appendChild instead of innerHTML. var s = document.getElementById("select-id"); var op1 = document.createElement("option"); op1.setAttribute("value",dateval); s.appendChild(op1); ... EDIT: it looks better inside a loop ;)

Categories : Javascript

Why do my Javascript global variables only update once? jQuery last-child selector error?
I think your problem is that you're never binding to click on the newly created person. Calling $("#add_more\."+oldID).click(...) will bind to the original item, but not to new items as oldID changes. Instead, I think you should be putting classes onto your elements: <td> <input name="person.32" id="person.32" class="person" <!-- the important line --> type="text" value="" placeholder="Lastname, Firstname" onfocus="this.select();" /> </td> Then, you can use something like jQuery.on: $(document).on("click", "person", function() { // Check that this is the last person here }); That way, every time you add a new person, you won't have to bind a new handler, it will already work.

Categories : Javascript

Assigning an array value to a variable inside a for loop in vba
Your problem is the For Each i In Products What this does is assign the value of each element of Products to i in turn. Then when you use Products(i) you are in effect saying, eg Products("1-2-3 ABC--150") which is of cource nonsence. Try instead For i = LBound(Products) to UBound(Products) or For Each Product In Products If Product = Sheet1.Product1ComboBox.Value Then Sheet1.Range("H2").Value = Product Exit For End If Next

Categories : Excel

difference between assigning method to prototype inside or outside the function
If you add them to the prototype they will be initialized once and shared between all instances. This will save CPU and memory, make it easy to change it for all existing instances and have inherritance (where instanceOf is true as Parent.call(this) would not). To re initiate the prototype or part of it everytime you create an instance doesn't make much sense though. What prototype does and the difference between properties defined with this.someProp in the constructor body or on the prototype is explained here.

Categories : Javascript

CSS selector: Style the first "a" inside a div
first-child should work absolutely well, you can try div:nth-of-type(1) a { /* Or div:first-child a */ color: red; } The above selector will select all 1st div element and will apply color to all a which are inside 1st div Demo If you are willing to style 1st occurrence of a in every div tag than you need to use div a:nth-of-type(1) { /* Or div a:first-child */ color: red; } Here every 1st a will be selected in every div tag Last but not the least if you want to select 1st a only in 1st div than use the below selector div:nth-of-type(1) a:nth-of-type(1) { /* Or div:first-child a:first-child */ color: red; } Note: If still the above selectors doesn't work, than the possibility is either some rule is more specific than the rules you are declaring, or !important

Categories : CSS



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.