w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Change element property based on placement of another element - jQuery
You can use .has() method or :has selector: $('p').has('cite').next('h1').css({'padding-top': 'value'}); Assuming all next h1 siblings of the selected p should be selected: $('p').has('cite').nextAll('h1').css({'padding-top': 'value'});

Categories : Jquery

Change style of an element by clicking on another element
I'd suggest, in compliant browsers: p:target { background-color : #ffa; /* or whatever you'd prefer */ } JS Fiddle demo. This is also possible in Internet Explorer, but will require html changes unfortunately. Or JavaScript could be used instead, if that would be preferred. In reference to the updated posted HTML, I'd adapt the above to the following: /* will highlight the 'div:target' itself: */ div:target { background-color: #f90; } /* will highlight the descendant 'p' element(s) of the 'div:target': */ div:target p { background-color : #ffa; } JS Fiddle demo. The key is to remember what element takes the :target pseudo-class, in this case it's the div, rather than the p (which is a child of that div element). References: Compatibility for :target pseudo-class. :

Categories : HTML

Convert / Change Div element with Form element
Use Javascript + jQuery: $('.myForm').children().unwrap().wrapAll("<form name='input' id='' action='html_form_action.php' method='post'></form>"); This removes the wrapping div ".myForm" with the unwrap method. Then wraps it's children with the wrapAll method.

Categories : Javascript

Change element style on hover of another element
.title:hover { color:#D01A13; } Spaces matter in CSS. The space is the "children" operator, so .title :hover means "when any children of .title are hovered over." Text nodes don't count as children. Here is a fiddle. Re your comment: Ok, this code is good, I did not know about spaces in CSS. But, forgot to mention that there is also a rule .title span {color:#888888 !important;} that complicates the things a little bit. If I cannot change this rule, is there any chance that the .title can change color on hover? Sure, you could try .title:hover, .title:hover span { color:#D01A13 !important; } Of course, this is very ugly. This is why you should use !important as little as possible. Fiddle

Categories : Javascript

Javascript - Change element's src in specified element
getElementsByName returns a list of elements, not a single element, so try: document.getElementsByName('p'+pos)[0]. getElementsByTagName("img")[0].src="player.png";

Categories : Javascript

Change element name without change in namespace
Try if following stylesheet <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pos="positionNS"> <xsl:output method="xml" indent="yes" /> <xsl:template match="/"> <xsl:apply-templates select="pos:getPositionRouter" /> </xsl:template> <xsl:template match="pos:getPositionRouter"> <pos:newElement> <xsl:apply-templates select="node() | @*" /> </pos:newElement> </xsl:template> <xsl:template match="node() | @*"> <xsl:copy> <xsl:apply-templates select="node() | @*" /> </xsl:copy> </xsl:template> </xsl:stylesheet>

Categories : Xml

XSL change the name of first element
Your input and output are not valid XML, but assuming you changed the last tag to a closing tag, this should work: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/> <xsl:template match="@* | node()"> <xsl:copy> <xsl:apply-templates select="@* | node()"/> </xsl:copy> </xsl:template> <xsl:template match="/*"> <ApplicationDataBatch> <xsl:apply-templates select="@* | node()" /> </ApplicationDataBatch> </xsl:template> </xsl:stylesheet>

Categories : Xml

Use PHP to change contents of an element
You can make all the Javascript(including Jquery) and HTML work using PHP by simply echoing the data. For example: <?php echo "<script>$('#error').css('visibility','visible');</script> ?> Remember using Single quotes in the Javascript so as not to clash with double-quotes of echo function of PHP.

Categories : PHP

Change text in an element using only css
You could potentially use: li:nth-child(6) { /* to hide the original text */ color: transparent; } li:nth-child(6)::before { content: 'Further back'; color: #000; } JS Fiddle demo. But CSS can't change the actual text, as such; it can show this text (but it won't be in the DOM, or accessible to JavaScript, or for selection/interaction by the user). If the original text is wrapped in its own node, for example a span, such as: <ul> <li>One</li> <li>Two</li> <li>Three</li> <li>Four</li> <li>Five</li> <li><span>Six</span></li> <li>Seven</li> <li>Eight</li> </ul> Then that can be hidden with the following: li:nth-child(

Categories : CSS

Change the order on element
No, you should call addSubview once. There are methods to manage subview position. This is two methods you can use: [muUIVew sendSubviewToBack: myUIImageView]; [muUIVew bringSubviewToFront: myUIImageView]; Should be pretty clear what they do.

Categories : Objective C

How to get the DOM element that triggered ng-change?
There's no (easy) way to do this by design. Angular controllers are supposed to be completely separate of the DOM, so if you find yourself needing to reference the DOM in them you're probably approaching things the wrong way. If your HTML is <select id="hairColorComponent" ng-model="hairColor" ng-options="option.name for option in hairColorData" ng-change="updateUserData()"> Then changing the select will change the value of $scope.hairColor in your controller. In updateUserData() just read its value and act accordingly. If in your situation there's really no way to do it except referencing the DOM, you could do it by writing a custom directive. In general, direct DOM manipulation in Angular should be a last resort kind of measure though.

Categories : Javascript

Why can't I change second element of array?
Because when you declare something like char * strPtr="Hello World"; it's actually a const char * so you can't modify it. You can change your code to char * strPtr= strdup("Hello World"); //free it after or char strPtr[30] = {0}; strncpy(strPtr, "Hello World", 11); and your code will be working

Categories : C

AS3 - XML change element value not working?
maybe this is what you need: var highScoresXML:XML =<highscores> <spelling> <first>0</first> <second>0</second> <third>0</third> <fourth>0</fourth> <fifth>0</fifth> </spelling> </highscores>; var highScoresArray:Array = new Array(); var highScoresNamesArray:Array = new Array(); for (var i:uint = 0; i<highScoresXML.spelling.children().length(); i++){ highScoresArray.push(highScoresXML.spelling.children()[i]); highScoresNamesArray.push(highScoresXML.spelling.children()[i].name() ); } highScoresArray.push(100); highScoresArray = highScoresArray.sort(Array.DESCENDING); highScoresArray.pop(); highScoresXML.spelling = new XML(); for(i=0; i<highS

Categories : Xml

Change value of an element in an array VBA
A user-defined function that you call/use in a worksheet cannot (added: without external help, such as complex win-api calls) change the application-environment. That is, you cannot use an UDF in a cell that would change any other cell, either its value or formatting. Put it this way, there are no Excel functions that ever change another cell are there? If you want to change the value of a cell then you need to create and run a sub-procedure. Added: A function that you want to use in a worksheet should behave like any Excel function; it performs calculations and returns a value. For example: Public Function MyTest(myRange As Range) As Double 'return a value by assigning it to the function name: MyTest = myRange(1).Value * 44 End Function

Categories : Excel

Change element location WPF
In code behind adding a name to the Line: <Grid x:Name="SetShipsGrid"> <Path Name="Line" Stroke="red" StrokeThickness="1" > <Path.Data > <GeometryGroup> <LineGeometry x:Name="line" StartPoint="50,50" EndPoint="350,50"></LineGeometry> </GeometryGroup> </Path.Data> </Path> </Grid> And then in the xaml.cs: this.line.StartPoint = ....

Categories : Wpf

Why can't I change the background of an
  • element?
  • It works. see fiddle how ever LI elements do not have padding margin by default so it looks like a solid block. add margin or padding to separate them #visit li { border:1px solid red; background-color:#F00; margin:1em 0; }

    Categories : HTML

    the right way to change one under the parent element
    Here is the corrected functionality $(function() { $('.department > a').click(function() { var obja = $('.department >a'); $(this).toggleClass('choose').siblings().removeClass('choose'); }) }) Fiddle Demo

    Categories : Jquery

    Change or Remove one character in an element src
    Use some like this: var element = document.getElementById('my-video'); element.src = element.str.replace('https', 'http'); Element: <video id='my-video' src = 'https://example... >

    Categories : Javascript

    CSS, cant figure out how to change this element in a theme
    Your problem is that the JavaScript in the page is setting the height of the <header>. You can change whatever you want in the CSS, but when the JavaScript is run it will set the height of the header to the size of the window, making it so it keeps taking up the whole screen. You can determine this by going into the developer console/panel/whatever in a browser and manually setting the height of the header element. It will change. But as soon as you re-size the page a bit it will return to taking up the full size of the screen it will have the CSS attribute height set to the height of the window. To change it, you'll have to go into the JS files, find the offending code, and either put in an exception for the header or remove that functionality and pray that the website works witho

    Categories : HTML

    How to change class of a div by hovering on another element
    First, make some functions to add and remove a class from a HTMLElement, you'll be interested in the Element.className property for this.. function hasClass(e, c) { return (' ' + e.className + ' ').indexOf(' ' + c + ' ') !== -1; // in list } function addClass(e, c) { if (!hasClass(e, c)) e.className += ' ' + c; // add if not in list return e; } function removeClass(e, c) { var i, s = ' ' + e.className + ' '; c = ' ' + c + ' '; while (-1 !== (i = s.indexOf(c))) { // while class in list s = s.slice(0, i) + ' ' + s.slice(i + c.length); // replace with space } e.className = s.slice(1, -1); // set return e; } Then attach listeners in your favourite way, for example you can use a similar pattern to your existing way if you write functions for mous

    Categories : Javascript

    Change an element after loading a div from another page
    it returned null because this div was copied That's not the case. I believe you are simply trying to access the element before it exists. Pass a callback to .load and change the class once the HTML was loaded: $("#header").load("index.html #header", function() { $('#about').addClass('active'); }); See also: Why does jQuery or a DOM method such as `getElementById` not find the element?.

    Categories : Javascript

    Change cloned element on draggable
    DEMO $("li").draggable({ helper: 'clone', start: function (event, ui) { $(this).closest('ul').find('li:last').addClass("color_").addClass('li-drag').addClass("ui-widget-content");; } }); when clone is created it is the last object in the parent so to addClass to the clone we can do $(this).closest('ul').find('li:last') or $(this).parents('ul').find('li:last') or $(this).parent().find('li:last')

    Categories : Jquery

    How to change the style element of a div with jQuery
    This works, but those inputs already have that image as a background. (http://localhost:9060 is not really working for me and don't use it in jsfiddle) You had a $(this).parent().css('0px', '0px'); line in the JS, which is not doing much. $("#SelectAllBtn").on('click', function () { $("#departmentList input[type=checkbox]").parent().css({ background: 'red', width: '19px', height: '19px', cursor: 'pointer' }); });

    Categories : Jquery

    $(this) child element css change not working at all
    this within the function you're passing setTimeout will be window, not the element. (this depends on how a function is called, not where it's used.) You can save the this value the event handler got (or actually, as you're going to jQuery-wrap it, just do that with a var outside the setTimeout function), e.g.: $('.item').mouseenter(function() { var $this = $(this); setTimeout(function() { $this.find('.item-overlay').css('z-index', '-1'); }, 300); // ...

    Categories : Jquery

    How to change Element innerHtml to Dart SDK 0.7.1
    I changed code _box.innerHtml = html.toString(); ==> _box.setInnerHtml(html.toString(), treeSanitizer : new NullTreeSanitizer()); and it work.

    Categories : Dart

    I'm having some trouble trying to get my script to change a element
    You just need to set the html inside the #result span. Using the .html() function. jQuery(document).ready(function ($){ $("#calculator").click(function () { $("#result").html('A new value'); }); }); http://jsfiddle.net/Stijntjhe/NFQpw/10/

    Categories : Javascript

    Change color of certain element in AutoCompleteTextView
    I had a problem with my ListView, which I believe is similar to yours. My problem was that the value of 'position' (within getView) kept reverting back to zero when I reached the bottom of the ListView; so when I scrolled back up the ListView I was starting from zero at the bottom. I got around the problem by forcing my 'View' to null, in your case mView. public View getView(int position, View convertView, ViewGroup parent) { mView = null; if (convertView == null) { LayoutInflater vi = (LayoutInflater)appContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mView = vi.inflate(id, null); } return mView; } Or possibly if you know the value that the first TextView will be you could do: final String viewTitleText =

    Categories : Android

    Change an element style by hovering another
    Try this on for size: .app:hover ~ .frame { background-color: yellow; } .frame { background-color: blue; width: 300px; height: 300px; } Demo: http://jsfiddle.net/maniator/jWA3s/1/ Reference: What does the CSS ~ (tilde/squiggle/twiddle) selector do?

    Categories : HTML

    Using css transition to change element position
    You need to apply the transition to the .info. You can only animate a property, not the layout: .box{ width: 400px; height: 400px; overflow: hidden; position: relative; } .info{ position: absolute; top: 0; margin-top: 90%; -moz-transition: all 0.5s ease-in-out; transition: all 0.5s ease-in-out; } .box:hover .info{ margin-top: 0%; } http://jsfiddle.net/Recode/fXXsS/2/ edit: I know, at the moment it's a little hack, because if the height changes, there's a problem. ;)

    Categories : HTML

    python last element change to different format
    You can specify a separator and join the list: print ", ".join(str(x) for x in lst) Also, I recommend not hiding the builtin name list and call your numbers something else.

    Categories : Python

    Is it possible to change the current element from div to a tag with jQuery?
    See this link. For your example you would do something like this: $('.item').each(function() { $(this).replaceWith($('<a>' + this.innerHTML + '</a>')); })

    Categories : Javascript

    Change a element's CSS when browser scrolls to it
    here is you solution http://jsfiddle.net/hushme/VF46X/ $(window).scroll(function(){ $('.hide').each(function(){ var h = $(window).scrollTop(); var o = $(this).offset().top; var height = $(this).outerHeight(); var t = o-(height*1.3); if (h >= t) { $(this) .css('background','green') }else {$(this) .css('background','blue')} }); });

    Categories : Jquery

    How can I change opacity of first listview element?
    When you change the opacity property of ListView it does not affect to it's items separately(opacity changes for ListView as a whole). If you want to set all items opacity to 0.5 except one, try to do something like this for(int i=1; i<display.Items.Count;i++) display.Items[i].Opacity = 0.5;

    Categories : C#

    How do I change some content that is not in a descendant element?
    @Adithya Kiran : Slurp the input file content into a variable $document and then do the below- $document =~ s/(d{4}.d{2})(?!(?:(?!</link>|<link>).)*</link>)/<adi>$1</adi>/isg;

    Categories : Xml

    Change margin of element on keydown
    Change <div class="player"> Player </div> to <div id="player"> Player </div> The reason it's not working is because you're calling document.getElementById(id) while the element has a class.

    Categories : Javascript

    Do something on change of display property of element
    The DOM is a view. Things like "do something when this happens" is an event-like trigger, this belongs in your model. Find all places where you set display: none; and replace it by a hookable process.

    Categories : Javascript

    When i drag element "div" and drop to "ul" i want to change "div" into "li"
    UPDATE DEMO http://jsfiddle.net/yeyene/7fEQs/7/ JQUERY $(function() { $( "#sortable" ).sortable({ revert: true, receive: function(event, ui) { $(this).find('div').removeClass('ui-state-highlight ui-draggable').css({'display':''}); var html = []; $(this).find('div').each(function() { html.push('<li class="ui-state-default">' + $(this).text() + '</li>'); }); $(this).find('div').replaceWith(html.join('')); } }); $( "#draggable" ).draggable({ connectToSortable: "#sortable", helper: "clone", revert: "invalid" }); $( "ul, li" ).disableSelection(); });

    Categories : Jquery

    Change font of spinner's element
    Make a new xml file and like below- <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/spinnerTarget" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textColor="#000000" android:textSize="13sp" /> change the textSize which you want. and use the below adapter code to fill it. Spinner food = (Spinner) findViewById(R.id.spinner1); ArrayAdapter<CharSequence> foodadapter = ArrayAdapter.createFromResource( this, R.array.item_array, R.layout.spinner_layout); food.setAdapter(foodadapter);

    Categories : Java

    How do I change left with element label?
    You can move the entire li. http://jsfiddle.net/pyuAU/ HTML <ul class="skill-holder"> <li><input name="skills[]" class="skills" value="1" type="checkbox" /></li> <li><input name="skills[]" class="skills" value="2" type="checkbox" /></li> </ul> CSS .skill-holder > li { position: relative; } JS $('.skill-holder').on('change', '.skills', function() { var $this = $(this), parent = $this.closest("li"), moved; if(moved = $this.is(':checked')) { parent.append('<span class="text">اضافه</span>'); } else { parent.find('.text').remove(); } parent.animate({left:moved ? 500: 0},1000); });

    Categories : Jquery

    is it possible that by clicking, the class of the element change?
    YOUR_ELEMENT.addEventListener("click", function(){ this.classList.toggle("changestyle"); }); Demo: http://jsfiddle.net/DerekL/KpwkG/ | http://jsfiddle.net/WsGGa

    Categories : Javascript



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