w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Hiding Table elements with jQuery
This is just one method, but a powerful one. You can put the table into a DIV, and then use jQuery's .html() method to replace the entire Div with new content. Here is a working jsFiddle <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script> <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" /> <style> table, tr, td {border:1px solid green;border-collapse:collapse;padding:5px 5px;} </style> <script type="text/javascript"> $(document).ready(function() { $('#theTable td')

Categories : Jquery

showing and hiding elements in select with Jquery
Firstly you have value="Program 1" twice: <option value="Program 1">Program 1</option> <option value="Program 1">Program 2</option> This should be: <option value="Program 1">Program 1</option> <option value="Program 2">Program 2</option> Secondly, you are not selecting the class correctly: $('.section_container' + newselection).show(); This should be: $('.section_container .' + newselection).show(); Demo Javascript $('.section_container > div').hide(); $('#form_selection').change(function () { var selection = $(this).val(); var newselection = selection.replace(' ', '_'); $('.section_container > div').hide(); $('.section_container .' + newselection).show(); });

Categories : Jquery

jquery selector for all elements except attributes in an array
I'd suggest: $('div.tabPage').not('#' + idlist.join(', #')); JS Fiddle demo. If you prefer a more verbose approach, you could instead use filter (which will either remove, or retain, the elements from the selection): $('div.tabPage').filter(function(){ return idlist.indexOf(this.id) === -1; }).addClass('jQueryFound'); JS Fiddle demo. References: Array.join(). Array.indexOf(). filter().

Categories : Jquery

Dynamically adding attributes to elements based on a selector in jQuery
Unfortunately, .on() won't help here. That's only helpful for event delegation. You should probably just bite the bullet and include the attributes directly. If you insist, you can use DOM Mutation Observers for this. For older browsers, you'll have to use the older DOM Mutation Events, which have now been deprecated. For an explanation of those two methods, read this article: Detect DOM changes with Mutation Observers.

Categories : Javascript

Hiding a Lua metatable and only exposing an object's attributes
I started out with the above question and after chasing down the rabbit hole, I was surprised by the limited number of examples, lack of examples for the various metamethods (i.e. __ipairs, __pairs, __len), and how few Lua 5.2 resources there were on the subject. Lua can do OOP, but IMO the way that OOP is prescribed is a disservice to the language and community (i.e. in such a way as to support polymorphism, multiple inheritance, etc). There are very few reasons to use most of Lua's OOP features for most problems. It doesn't necessarily mean there's a fork in the road either (e.g. in order to support polymorphism there's nothing that says you have to use the colon syntax - you can fold the literature's described techniques in to the closure-based OOP method). I appreciate that there are

Categories : Lua

Removing elements that have no attributes, child elements, or text during transform
This should do the job: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"> <xsl:output indent="yes" method="xml" omit-xml-declaration="yes"/> <xsl:strip-space elements="*"/> <!-- Elements/attributes to remove. Note that comments are not elements or attributes. Since there is no template to match comments they are automatically ignored. --> <xsl:template match="@*[normalize-space()='']|info|@file_line_nr|@file_name"/> <!-- Match any attribute --> <xsl:template match="@*"> <xsl:copy> <xsl:apply-templates select="@*"/> </xsl:copy> </xsl:template> <!-- Match any element --> &l

Categories : Xml

Hiding JSF elements with Java
Use rendered attribute of the <h:commandButton> to control if the component must display or not in the generated HTML: <h:commandButton id="btnSearch" value="#{SPP.fireStudyTitle}" action="#{searchBean.doMagic(SPP.acronym)}" immediate="true" onchange="submit();" style="font-weight:bold; font-size:small;" onclick="javascript:cursor_wait()" class="buttonsFEIS" rendered="#{not empty SPP.acronym}" />

Categories : Java

Hiding elements in XAML
I would recommend creating an ObservableCollection of objects you'd like to bind, and adding it to the LongListSelector like this: longListSelector.ItemsSource = myCollection;. Everytime you'd like to remove an element from the list, you'd just call something like myCollection.RemoveAt(0) and the list will update itself.

Categories : Xaml

Does hiding DOM elements improve performance?
ng-show and ng-hide will only set a CSS display style, and will still process the bindings. ng-switch, however, will completely comment out the cases that do not apply, which in turn means bindings in those are not processed. I agree, however, with Edmondo1984's reply, that I doubt you should base your choices on this. Do not rewrite your ng-shows as ng-switches because of this! You can verify this with the Chrome extension Batarang, the performance tab shows which watches are active.

Categories : Performance

hiding li elements of specific classes
I think you want to use .find: $("#image,#image1,#image2,#image3,#image4,#image5,#image6,#image7,#image8,#image9,#image10").find("li").hide(); You may want to shorten that selector attribute startsWith: $("[id^='image']").find("li").hide();

Categories : Jquery

Hiding Elements for iOS/Android Based on userAgent
Well, this is embarrassing. I guess I should pay more attention to parenthesis, huh? Long day of coding... oh well. Solution (thanks to Janith above): <script type="text/javascript"> jQuery(document).ready(function ($){ if (navigator.userAgent.match(/(iPod|iPhone|iPad)/i)) { $('.download').hide(); $('.rss').hide(); }; if (navigator.userAgent.match(/Android/i)){ $('.itunes').hide(); }; }); </script>

Categories : Jquery

Showing/hiding elements ajax Drupal
<code> $form['enter_amt'] = array( '#type' => 'checkbox', '#title' => t('Enter Billable Amount'), ); $form['billable_ctc'] = array( '#type' => 'textfield', '#title' => t('Billable CTC'), '#maxlength' => '15', '#field_prefix' => t('Rs.'), '#states' => array('invisible' => array(':input[name="enter_amt"]' => array('checked' => TRUE), ), ), ); $form['billing_rate'] = array( '#type' => 'textfield', '#title' => t('Billing rate'), '#maxlength' => '7', '#field_suffix' => '%', '#size' => 3, '#attributes' => array('class' => array('auto-width')), '#states' => array('invisible' => array(':input[name="enter_amt"]' => array('checked' => TRUE), ), ), ); </cod

Categories : Ajax

Chrome Extension: Displaying & Hiding Elements?
function fixButtons() { var buttonGroup = document.getElementsByClassName("myAwesomeButtons")[0].getElementsByTagName("button"); buttonGroup[0].style.visibility='hidden'; buttonGroup[1].style.visibility='visible'; }

Categories : Javascript

Hiding elements in table causes columns to shift
Try with $(document).ready(function() { $('.hide').hide(); }); slideUp may causes the meshup and also give width to td like table tr td{ width:200px; } See this DEMO See this using slideUp DEMO2

Categories : Javascript

Hiding text elements in D3 chord diagram
You can select with a logical OR like this: svg.selectAll("path.chord, text.groupLabel") see the documentation on selections for more details

Categories : D3 Js

Mouseover Hiding Stacked Elements From Mouse (HitTesting)
Typical isn't it ... just as I ask the question the solution presents itself. In order to hide stacked elements from mouse events add this style declaration: .style("pointer-events", "none")

Categories : Javascript

How to animate elements move with css3 transitions after hiding some element
You could do something like this which uses a CSS class toggled by a little javascript and CSS transitions to do what you're looking for instead of using jQuery // The relevant CSS .item { // Your original code here transition: all .5s ease-in-out; -webkit-transition: all .5s ease-in-out; -moz-transition: all .5s ease-in-out; -ms-transition: all .5s ease-in-out; -o-transition: all .5s ease-in-out; } .hide { width: 0px; height: 0px; opacity:0; margin:0; padding:0; } // The javascript var items = document.getElementsByClassName('item'); for(var i = 0; i < items.length; i ++) { items[i].onclick = function() { this.classList.toggle('hide'); } }; function addBack() { for(var i = 0; i < items.length; i ++) { ite

Categories : CSS

maximise the special elements in the matrix
The best solution is to find an algorithm to solve the problem, and prove it correct. Lacking that, there are some more options. Backtracking This is a combinatorial problem, which you can solve with backtracking. The key points you need to successfully implement a backtracking algorithm to solve the problem are: Find a good heuristic for the next step Find a good early stopping heuristic, branch and bound I would solve it like this: Find all possible places where the next special element can be placed. There won't be many such places, as you pointed out already. Select all possible combinations of values that can be used to add the next special value, regardless of next steps in the backtracking. Keep track of which numbers are still to be placed and which are "usual" and special

Categories : Algorithm

XSL pass attributes to child elements if child elements do not already have the same attribute
Try this. <!-- root and static content - container --> <xsl:template match="/"> <section> <xsl:apply-templates select='section/container/*' /> </section> </xsl:template> <!-- iteration content - child nodes --> <xsl:template match='*'> <xsl:element name='{name()}'> <xsl:apply-templates select='@*|parent::*/@*' /> </xsl:element> </xsl:template> <!-- iteration content - attributes --> <xsl:template match='@*'> <xsl:attribute name='{name()}'><xsl:value-of select='.' /></xsl:attribute> </xsl:template> On outputting each child node, we iteratively transfer across its attributes and those of the parent. <xsl:apply-templates select='@*|parent::*/

Categories : Xslt

create elements and set attributes
You can simply write $('#myTable').append('<tr><td><input type="text" id="id"></td><td><input type="button" id="btnAdd" onclick="AddRow()" value="addrow"></td></tr>');

Categories : Jquery

Hiding li tag in jquery
Your selector $("li #"+tmp[i]).show(); is wrong. Your selector is looking for an element with id x which is a decedent of a li element. Since you have the element id there is no need to use element selector and id selector. it should be $("#"+tmp[i]).show();

Categories : Jquery

Perl - XML::LibXML - getting elements that have certain attributes
You were almost there. Just notice that author is not a child of image. Attributes do not have text() children, you can compare their values directly with strings. Also, toString is needed to print the values out instead of references. #!/usr/bin/perl use warnings; use strict; use XML::LibXML; my $parser = XML::LibXML->new(); my $xmldoc = $parser->parse_file('1.xml'); my $width = "145"; my $query = "//book[image/@width = '$width']/author/text()"; foreach my $data ($xmldoc->findnodes($query)) { print "Results: ", $data->toString, " "; }

Categories : Xml

XML Schema for same element name with different attributes and elements
This is not possible this rule is called "Element Declarations Consistent". The Element Declarations Consistent rule for model groups (http://www.w3.org/TR/xmlschema-1/#cos-element-consistent) rules out inconsistent element declarations like the following two conflicting definitions of element , i.e., cannot be both an "int" and a "string" in the same group: (example-1) <xs:complexType name="example-1"> <xs:sequence> <xs:element name="a" type="xs:int"/> <xs:element name="whatever"/> <xs:element name="a" type="xs:string"/> </xs:sequence> </xs:complexType>

Categories : Xslt

Disable all style attributes for all elements
There are two separate things - indent plugin should be able to indet only lists (changing their structure, not adding left margin), not blocks. At this moment one plugin does two jobs, what does not make sense. Patch for this will be released in about a month - https://dev.ckeditor.com/ticket/10027. Although, even now it is possible to configure indent to use classes rather than styles - see the config.indentClasses option.

Categories : Javascript

Using data attributes and jQuery how can I select elements by data attribute name AND data attribute value
you can use attribute selector var y = $('.my-class[data-id="' + i + '"]'); since the selector .my-class is repeated, you can cache it var els = $('.my-class'); for(var i=0; i<x.length; i++){ var y = els.filter('[data-id="' + i + '"]'); //trying to select here y.html('input' + i); } Demo: Fiddle

Categories : Javascript

jquery.cookie.js hiding always
Kept looking for answer and found it. $(document).ready(function() { if( $.cookie('showOnlyOne') ){ $('#cooked').hide(); $('#swipe-scroll').hide(); } else { $.cookie('showOnlyOne', 'showOnlyOne', { expires: 1, path: '/' }); $('#cooked').show(); $('#swipe-scroll').show(); } }); I'm guessing it's because I defined the cookie before the function. That said, it works great now.

Categories : Jquery

jQuery hiding and toggling
$('.article-row').click(function(){ if($(this).parent().find('.content').is(':visible')){ $('.content').hide(); $(this).parent().find('.content').show(); } }); Hide all elements, then display the clicked one. But first verify if the clicked article is not already the active one to make sure it doesn't flicker or look weird if you animate the transition.

Categories : Javascript

Hiding and showing div in Jquery
Write your code in document.ready function so it work, $(document).ready(function(){ $('#submit').click(function() { console.log("Called2") $('#container').show(); $('#login').hide(); }); }); or, its shorthand, $(function(){ $('#submit').click(function() { console.log("Called2") $('#container').show(); $('#login').hide(); }); }); for changing its visibility every time you can use toggle() function like, $(function(){ $('#submit').click(function() { console.log("Called2") $('#container, #login').toggle(); }); });

Categories : Javascript

Retrieving attributes of elements in Python using libxml2
Haven't used libxml2, but dived in to the case and found this, try either, if child.type == "element": if child.name == "myGrpKeyword": print child.prop('name') print child.prop('help') or if child.type == "element": if child.name == "myGrpKeyword": for property in child.properties: if property.type=='attribute': # check what is the attribute if property.name == 'name': print property.content if property.name == 'help': print property.content Refer http://ukchill.com/technology/getting-started-with-libxml2-and-python-part-1/ update: try a recursive function def explore(child): while child is not None: if not child.isBlankNode():

Categories : Python

Detecting attributes of elements in the HTML DOM with javascript
the childNodes attribute contains all nodes in the DOM, which specifically means, it includes text nodes. you have 3 of them - the newline/linefeed characters inside your div. you can test for element children using the nodeType attribute ( see eg. here; 1represents ELEMENT_NODE, 3 stands for TEXT_NODE).

Categories : Javascript

Ember is there alternative way for binding elements attributes
The problem here is (as you surely already know) that Jsoup tries to parse your HTML markup with the included handlebars expressions, and by doing so it check's for valid HTML, so in the case of bindAttr this is interpreted as a attribute for your <li> tag, and because a valid attribute is something like class="foo" Jsoup converts it to bindAttr="". Lamentably there is no built-in way of telling Jsoup to ignore tags with no values. I guess you should try another tool that fit's your needs. Hope it helps.

Categories : Ember Js

Reading an XSD file to get all the elements and corresponding attributes in Java
The xsd format is perfectly valid XML, so you can parse an XML schema file with any xml parser. Check this related post to get some code samples and ideas: Java API to parse XSD schema file

Categories : Java

xml: how to indent child elements but keep attributes on new lines
Seems to me that XML::Twig's xml_pp utility does almost what you want with its indented_a option: $ xml_pp -s indented_a foo.xml <!DOCTYPE parent [ <!ENTITY entity1 "value"> ]> <main> <parent attr1="str1" attr2="str2"> <child childattr1="str3" childattr2="&entity1;" /> <child childattr1="str4" childattr2="&entity1;" /> </parent> </main>

Categories : Xml

D3.js: alternative to selecting elements by data attributes?
If you store the reference to your paths, you can use selection.filter here: var paths = g.selectAll("path").data(data) .enter().append("path") .attr("d", d3.svg.arc().innerRadius(ir).outerRadius(or).startAngle(sa).endAngle(ea)) ; Mouseover: d3.selectAll("#chart4 path").on('mouseover', function(thisData) { paths .filter(function (d) { return d.pathNumber === thisData.pathNumber; }) .attr('fill', 'black'); });

Categories : D3 Js

JAXB Unmarshall same elements with different attributes (lang)
Note: I'm the EclipseLink JAXB (MOXy) lead and a member of the JAXB (JSR-222) expert group. MOXy allows you to map to an element based on the value of an XML attribute using its @XmlPath extension: Java Model (Foo) import javax.xml.bind.annotation.*; import org.eclipse.persistence.oxm.annotations.XmlPath; @XmlRootElement @XmlAccessorType(XmlAccessType.FIELD) public class Foo { @XmlPath("name[@xml:lang='cs']/text()") private String csName; @XmlPath("name[@xml:lang='en']/text()") private String enName; } Demo import java.io.File; import javax.xml.bind.*; public class Demo { public static void main(String[] args) throws Exception { JAXBContext jc = JAXBContext.newInstance(Foo.class); Unmarshaller unmarshaller = jc.createUnmarshaller();

Categories : Java

XML Parent and Child Attributes and Elements in PowerShell
Something like this seems to do it, although i don't like that. [xml]$xml=Get-Content .xmlfile.xml $hits = $xml.segments.segment.resultpage.resultset.hit foreach($hit in $hits) { $result = new-object PSObject -Property @{ hit = $hit.no; filename = ""; path = ""} foreach($field in $hit.field) { if ($field."NAME" -eq 'url') { $result.path = $field."#text" } if ($field."NAME" -eq 'filename') { $result.filename = $field."#text" } } write-output $result } or, just grabbing all fields, and then selecting relevant: [xml]$xml=Get-Content .xmlfile.xml $hits = $xml.segments.segment.resultpage.resultset.hit foreach($hit in $hits) { $result = new-object PSObject -Property

Categories : Xml

Trim() the values of all xml elements and attributes in an xml document using c#
Using LINQ to XML, how about something like: foreach (var element in doc.Descendants()) { foreach (var attribute in element.Attributes()) { attribute.Value = attribute.Value.Trim(); } foreach (var textNode in element.Nodes().OfType<XText>()) { textNode.Value = textNode.Value.Trim(); } } I think that should work... I don't believe you need to use ToList to avoid disturbing things as you iterate, as you're not changing the structure of the XML document, just the text.

Categories : C#

Hiding an element after another is clicked through Jquery
Try this $(".subFaq").hide(); $(".showFaq").click(function(){ $(".subFaq").hide(); // hide all the faq before showing the current one $(this).next().slideToggle('slow'); });

Categories : Jquery

jQuery animate() after hiding all but one element
You do not need to do $($(this).attr("id")) as $(this) is fine. Also, the inner jQuery selector changes the meaning of 'this' to be different. If you want it to stay the same, you need to keep a reference to it first e.g. $(".fader").click(function (e) { var self = this; $('.fader').not(self).fadeOut(function() { $(self).animate({width: "200",height: "200px", top: "-=440px", left: "-=367px"}); }); });

Categories : Javascript

Hiding and Showing Tabs in Jquery
Your elements share ID's, which is not allowed, try this: $('.names ul li').click(function(){ $('.resource-box div').hide(); // hides all divs $('.resource-box div').eq($(this).index()).show(); // shows correct one }); The key part of the code is eq($(this).index()), which grabs the index (what number child the list item is) and then uses that to decide which div to show. Of course, this means they have to be in the same order

Categories : Javascript



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