FAQ Database Discussion Community


How to element content into new element

html,html-table,element
Is there a way to move content within a element into a another element for example : <td>move this content</td> <div>into here</div> ...

Setting On Change on id from parameter does not work

jquery,forms,sharepoint,element,onchange
I am using SharePoint 2013, but this is more of a jQuery question/issue. In SharePoint, the form elements are given ID's based off of the name and a key of some sort. I am able to get the ID for the form element that I am trying to add a...

Adding an attribute to element

jquery,attributes,element
I'm trying to add an attribute to an element. The attribute would indicate a certain height and the position of the center of the screen width. That's why I tried using jquery in order to get the position of the center of the screen width. So, this code: <script>$("p.slider-price").attr('data-position', '145,...

Array create group on the basis of particular field value

php,arrays,group,element
I have following array array ( [0] => Array ( [market_id] => 10 [competition_id] => 31 ) [1] => Array ( [market_id] => 10 [competition_id] => 31 ) [2] => Array ( [market_id] => 11 [competition_id] => 31 ) [3] => Array ( [market_id] => 11 [competition_id] => 31 )...

Removing a DOM element with Javascript

javascript,dom,onclick,element,removechild
I've been trying, unsuccessfully, to close/remove a DOM element when an image is clicked. I have built the code for the elements to be called onload but now I need for them to close or be removed from the body onclick of an image. This is the code to call...

Random Numbers Array not working in the javascript

javascript,random,element
i have javascript Array var Numbers = [ 1,2,3]; document.write (Numbers[ Math.floor( Math.random( ) * 3 ) ] ); i want to put it into the URL Like this: "//connect.facebook.net/en_US/all.js#xfbml=1&appId= + Numbers + "; i want to show random numbers after appId=...

Any suggesstions to locate the below elements in Selenium

selenium,xpath,selenium-webdriver,element,locate
Example HTML below. I want to locate the elements which contains the text Person Attributes and Age. <div id="ext-gen210" class="x-tool x-tool-toggle"></div> <span id="ext-gen214" class="x-panel-header-text">Person Attributes</span> </div> <div id="ext-comp-1071" class=" DDView ListView" style="height: auto;"> <p class="dragItem "><i class="icon-Gen"></i>Age</p> </div> Note: I am looking for a solution without using xpath or id...

vector of objects , delete and place objects

c++,object,vector,element
I want to have a vector of vector of objects,lets say a 2d vector of chessPiece class. I want to be able for each position in the vector to check if there is a chessPiece or not inside it.Also I want to change it for example place a new ChessPiece...

How do I copy all css from a website using Chrome's inspect element.

element,inspect
I'm coding a website and using a Chrome window to view my work. I've tried to copy my changed CSS, so I can save it in my Sublime file, and there doesn't seem to be a way. Any suggestions?

jquery element + next

jquery,hide,element,next
I have this code in my site that is auto generated and would like to get the <p> tag and hide it. <div id="PD_superContainer"></div> <script type="text/javascript" charset="UTF-8" src="//static.polldaddy.com/p/8895171.js"></script> <noscript>&lt;a href="http://polldaddy.com/poll/8895171"&gt;Take Our Poll&lt;/a&gt;</noscript> <p></p> ...

How to limit for loop to print first few element from list in terms of their value in python?

python,list,loops,element,value
I would like to limit for loop to print first few element from list in terms of their value. For example, if i < 6 : list = [1,2,3,4,5,6,7,8,9,10] for i < 6 in list: print(i) Thanks in advance !...

How to put HTML code in a jQuery array as variable, then use that var to replace content?

jquery,html,arrays,variables,element
There is a page with a list of links, which need to change the information on the right. I tried something in jQuery, but I'm doing something wrong, of course. HTML <div class="left"> <a name="top"></a> <div class="title"> <a class="options" href="#top" data-value="0"> Title </a> </div> <ul> <a class="options" href="#top" data-value="1"><li>Link 1</li></a>...

Edit Multiple XML Nodes in Multiple XML files

xml,element,textnode,xml-editor
I have multiple XML files(60+) that I need to edit multiple text nodes(I think it's called). I am familiar with Java, JavaScript, Python, JQuery, PHP, HTML. What language could I complete this with? This is what I current have for a sample XML doc: <?xml version="1.0" encoding="utf-8"?><bookstore> <book category="cooking"> <title...

Copy element without content using xslt

xml,xslt,copy,element
i´m desperately looking for a simple solution to my problem and hoping that someone out there is able to help :). Problem: Given is a xml document containing elements with attributes. I need to pick some element values, put those before the elements and remove the elements content afterwards using...

Create element function doesn't work

javascript,jquery,html,css,element
I am new in Javascript, So I have small problem, First here is my live Code & written here. this is my index.php file <ul id="friends"> <li id="Maxi" class="user">Maxi</li> <li id="John" class="user">John</li> <li id="Henry" class="user">Henry</li> <li id="Max" class="user">Max</li> <li id="Simon" class="user">Simon</li> </ul> <div id="windows"></div> It is my stylesheet page. .user{...

Add class to nth of an element found on full page instead within a parent

jquery,jquery-selectors,element,addclass
I'm trying to add classes to the "nth" of a particular element - regardless of where it falls on the page. A simplified version of my html is: <div class="row"> <div class="col-sm-12"><section class="subsection"></section></div> <div class="col-sm-12"><section class="subsection"></section></div> </div> <div class=“row”> <div class="col-sm-12"><section class="subsection"></section></div> <div class="col-sm-12"><section...

Getting element from a certain numpy array returned from OpenCV?

python,arrays,opencv,numpy,element
I am trying to get information (coordinates) that is within a numpy array and I am having a difficult time extracting information from it. The numpy array was returned by an openCV method, cv2.calcOpticalFlowPyrLK, which produced coordinates of each point in a numpy array. This is the output for a...

Why does href appear not to work with id?

html,href,element
<a href="http://www.website.com"><h1><a id="Didn&#39;t-answer-your-question&#63;">Didn&#39;t answer your question?</a><!--ID end--></h1></a><!--link end--> Can I have an id element inside a href element, for the link text or does this not work, if so do people have an alternative?...

Why can't I gain control of 'list'

html,css,element
so, managed to sort my nav bar out the way I like it... However now I've moved onto what I want underneath it. Except I cannot appear to 'gain control' over the 'list' element... What am I doing wrong? <!DOCTYPE html> <html> <head> <title>St George's League - Home</title> <link rel="stylesheet"...

Need to export tables inside a
as excel, keeping filled-in input and option data

javascript,html,excel,export,element
I have a page that takes some selections in javascript and makes a recommendation based on the inputs. Some of my customers want to be able to save this data in excel format, but I'm running into issues retrofitting that. Here is the code that I found to export the...

jQuery trigger on element that is added after page load

jquery,ajax,element
I have an jQuery ajax form. When it's completed, it changed the ID of an element like this: jQuery('#ready').attr('id','done'); Then, I want to do a mouseover() function targeting #done. The problem is that it does not work because #done was not loaded on page load. What is the normal solution...

Unique elements in each column of an array (Matlab)

arrays,matlab,unique,element,vectorization
I might be a bit rusty with Matlab, maybe the answer to this question is more trivial than I imagine at this moment. However I have searched online for efficient solutions and I haven't found any, so I will try here. I have a large matrix, something like y here:...

C code Count elements in array that are not null

c,arrays,count,element
going over old exam papers and doing questions, for this one: array is: char* s[]={"one","two",NULL,NULL,"five","",""}; using function name: int inUse(char *s[],int len) I have to determine the number of elements that are not NULL. I have come up with: int count=0; for(i=0; i<7, i++) { if(s !=NULL) { count ++;...

jQuery button to show/hide multiple divs with same id

jquery,jquery-selectors,click,element,slidetoggle
I have many products being populated dynamically, all with same id and class names. I want each "Buy Now" button to have its own div that toggles with click of button. I do have the ability to assign an incrementing number index to the ids and classes, however, if there's...

Prolog- Returning elements from facts

prolog,return,element,fact
i encounter a problem with facts. Let's say i got 3 facts and check(X) question. fact(a,b). fact(b,c). fact(a,d). check(X):- //some calculation with fact() How to make above question to return list of elements for given X from all facts? For instance: check(a) would give result b and d. So i...

Get an HTML element's line number

html,dom,element,codemirror,ace-editor
Was wondering if there is a better way to find an elements line number in the sources code. This is what i've go so far: // Get the item that the user is clicking on: var focused = doc.getSelection().anchorNode; if(focused.nodeType == 3){ // text node focused = focused.parentNode; } //...

How do I add all elements from a list in F# recursively?

list,recursion,f#,element
I'm very new to F# so I have been trying to sum all the elements(double integers) line in a text file to print out year and the total number of elements. (sample from text file): 2010 **(the elements)->** 1.07 1.56 1.74 3.84 6.8 7.89 9.2 3.46 1.67 2.22 2.49 2.81...

php dom only edit parent element and not child elements

php,dom,element
I am trying to edit nodevalue of only the parent element (eg hold1) and not the child elements. The below code successfully lets me edit the child elements but when i edit the parent element, it removes the child elements completely. Please help. $file = 'home/aa.php'; $doc = new DOMdocument();...

Accessing a external browser with c# [closed]

c#,search,browser,external,element
i was just wondering if you can access an browser externally with c#, and see if there is a certain word is in the webpage? I have done a lot of research, but none that are specific to what my problem is, Thanks in advance :)...

Delete parent element with javascript

javascript,element,parent
I'm having a problem with my javascript. I want to create some kind of to-do list but I can't figure out how to delete an item. When creating an item, it adds to the list with a delete button, but I don't know what to do for the item to...

get a specific value from arraylist element java

java,arraylist,element
i have an arraylist where it has certain number of elements, each consisting of two values (day,cents) company.getAnnouncements().get(0) The above code will retrieve the first element in the arraylist, but i only want the cents component of that element. How would you do this?? public class Announcement implements Event {...

Moving similar elements from one list to another

python,list,element
In short, I am trying to detect if there are 4 of a kind of one element in a list and then move all 4 of those elements to another list. So far I have: human_hand = [4,5,6,4,5,3,4,5,4] discard = [] for i in set(human_hand): if human_hand.count(i) == 4: discard.append(i)...

Remove img-element from Angular page

javascript,jquery,angularjs,element,angular-directive
I'm creating an angular web app in which I want to show an image at first, but when you click on a button, I want to remove this default image and replace it with a videostream of the webcam. But so far, removing the image - element remains hard... angular.module('qrWebapp').directive('qrScanner',...

How to find neighbor element of array 1 from reverse of the same array

javascript,arrays,find,element,neighbours
function compareNumbers(x, y) { return x - y; } var a = [3,6,2,7,8,10,43] //I have one array var b = a.slice().sort(compareNumbers).reverse(); //I reverse this array //Now I have 2 arrays a = [3,6,2,7,8,10,43] b = [43, 10, 8, 7, 6, 3, 2] My Question: I want to find the neighbour...

sum up each individual values from 2 arrays

javascript,arrays,sum,element
I'm trying to understand this conditional loop to sum up each elements from 2 arrays, but I stumble upon the latter part, I don't understand what is to be achieved there. Can you please explain to me? function Arrays_sum(array1, array2) { var result = []; var ctr = 0; var...

why only adding last element arraylist on new arraylist [closed]

java,for-loop,arraylist,duplicates,element
there's the goal result : [[a],[a,b],[a,b,c]] but when I running my code, the result was : [[a,b,c],[a,b,c],[a,b,c]] this is the source code : public class Try { ArrayList<String> al=new ArrayList<String>(); List<List<String>> hm=new ArrayList<List<String>>(); public void addal2(){ for(int j=0; j<3;j++){ al.clear(); for(int i=0; i<1;i++){ if(j==0){al.add("a");} else if(j==1){al.add("a");al.add("b");} else if(j==2){al.add("a");al.add("b");al.add("c");} } hm.add(al);...

C# Removing Last Element of a string Array?

c#,arrays,element
I am parsing a set of coordinates from an XML file. Each node will have coordinates like: -82.5,34.1,0.000 -82.6,34.2,0.000 In the code below, the coords_raw variable is already assigned the above value and I am trying to split into array lnglatset --which does look okay. string[] lnglatset = raw_coords.Split(' ');//will...

Splitting an array with commas to separate each elemnt

java,arrays,element
I have an output that comes out printing : 1 2 3 4 5 I want the output to be : 1,2,3,4,5 When I print my final array, It looks like : System.out.println(D); What should I add to it to suit my needs. All answers are welcome.

applying a Function to Each element in an array (O'Reilly cookbook example)

arrays,function,each,element,apply
for nested data. I tried <?php $names = array('firstnames' => array("Baba", "Billy"), 'lastnames' => array("O'Riley", "O'Reilly")); array_walk_recursive($names, function (&value, $key) { $value = htmlentities($value, ENT_QOUTES); }) foreach ($names as $nametypes) { foreach ($nametypes as $name) { print "$name\n"; } } ?> (An example from the book O'reilly PHP Cookbook 3rd...

Change text content with XPath

java,xml,xpath,element,xmlnode
Although I am able to set a text value inside a node with the code below private static void setPhoneNumber(Document xmlDoc, String phoneNumber) { Element root = xmlDoc.getDocumentElement(); Element phoneParent = (Element) root.getElementsByTagName("gl-bus:entityPhoneNumber").item(0); Element phoneElement = (Element) phoneParent.getElementsByTagName("gl-bus:phoneNumber").item(0); phoneElement.setTextContent(phoneNumber); } I cannot do the same with XPath because I get...

Directive Angularjs, $watch and HTML Element

html,angularjs,element,directive,watch
I have a question. I coded a HTML page with an angularjs directive this is my code <menufileupload visible="rightVisible" alignment="right"> <input type="text" ng-model='expr'/> <!--Other stuff--> </menufileupload> I'm trying to use a $watch to check any change in the text field $scope.$watch(...) only worked when the text field is out of...

jQuery only applies to the first elements on every page [closed]

jquery,toggle,element
I have a bunch of html elements with the same ids and classes. I have added a jQuery toggling function to these classes and ids, but it only works properly on the 1st samples on every page. How do I fix it?

Change the text of several elements on a timer with onClick

javascript,element,swap
I have a button that onClick starts a timer that calls a function and passes the counter. I used an alert box to see that I was getting counter as 0. If counter is 0, it should load the table with the text (it skips it) it goes to the...

jQuery - Each loop to select all items by data attribute, but also dependent on select (option) values

javascript,jquery,loops,attributes,element
I am in the process of building an e-Commerce shop and have hit a small bump in the road for my actual product page. Based on any product options set that would add to the price if selected, I would like to be able to update the price on the...

HTML Elements in jQuery and CSS styling in jQuery [closed]

jquery,html,css,stylesheet,element
I am known to HTML and CSS. Now I am trying to learn jQuery. I want to know how to make a DIV in jQuery and then style it with CSS in jQuery? I have searched alot on google but cant find any help there. I hope you can help...

Is it possible to crop an Element using Elm's std library? If not, is there a 3rd party lib for this?

forms,scroll,element,crop,elm
I often run across a situation where I've constructed an Element or Form and wish to crop the view down to a given area (i.e. for scrolling within a smaller rectangle) though I haven't been able to find any methods for this within their respective modules. Is it possible to...

Comparing nth element of list with another nth element, then swapping if statement true PYTHON 3.4.3

python,list,element
I've got two lists. Both of them related to a theater's auditorium. The first list contains the occupancy of the chairs like this: xxooxoxoooxoxo ooxoxooxoooxox ... ... x = occupied, o = free My second list contains the price category of the chairs like this: 33221111112233 33333222233333 ... ... I...

Protractor not able to count links in a list (li)

javascript,angularjs,selenium,protractor,element
This is my first message, basically because is the first time that I have not been able to find the answer to my question. I am trying to count the number of li elements in a dropdown. Each <li> has a` link. Here is the HTML code: <div ko-dropdown="ko-dropdown" ng-keyup="onKeyup($event)"...

Set height of an image same as a neighboring element CSS

css,image,height,element
I was wondering how could you set height of an image to the neighboring elements height. So, essentially I want to have it like this: [div] [img] Other than javascript I can't see a way how can I do this. So, instead of using js can I just use CSS?...

vector/array bounds check only when a define is declared

c++,class,operator-overloading,operators,element
I've create my own container that is inherited from a vector. I would like to reimplement operator[] in a way that makes checking for bounds decided by a #define. So putting an example, and ignoring template parmameters as they're complicated and irrelevant class MyArray : vector<double> { //... virtual double&...

Is it possible to add same existing dom structure after clicking button jquery?

javascript,jquery,html,dom,element
I have ten textfields in one div. I want to add another ten textfields with same name and class and id. Is it possible to reuse the above DOM structure or do I have to again create ten textboxes with jQuery and append them? I have tried creating and appending...

.getTextContent returns text from child elements too

java,xml,string,get,element
I'm trying to get XML parsing down (and yes I know there's easier ways to parse/validate like xstream) but I can't seem to get text content of just a single element. For example: <container> <element0>textThatIWant</element0> //only returned by .getTextContent <element1> <subelement0>textThatIDontWant</subelement0> //but also returned by <subelement1>textThatIDontWant</subelement1> //.getTextContent </element1> <container> I'm...

Is it possible to hide a child element with parent of parent element? [closed]

javascript,css,hide,element,fadeout
<div class="grandma"> <span class="file-name">file name</span> <span class="percent">100%</span> <div class="clear"></div> <div class="mother"> <div class="upload-success"></div> </div> </div> As "upload-success" appears on the screen, I want to fade out "upload-success" in few seconds with "grandma" and everything inside of "grandma". I don't know much about js yet so I wonder if it's possible...

How to locate elements with Appium (Python), I failed all the time

python,webdriver,element,appium,locate
Codes: #Testing a simple Calculator App on Android Device. #Tried many methods to locate an element, but failed. #The information I can get from UI Automator Viewer is the class name, button name, co-ordinates. I just want to locate the button "7" and press it. import unittest, time, os from...

XSL for transformation of text node

xml,xslt,attributes,element,transformation
There is a xml (for the example the xml is simplified) <object attr1="1" attr2="2"> xxxxxxxxx <someattrs> <someattr1>a</someattr1> <someattr2>b</someattr2> <someattr3>c</someattr3> <someattr4 attr3="3"> yyyyyyy <someattr5>d</someattr5> <someattr6>e</someattr6> <someattr7 attr8="f"> <![CDATA[ zzzzzzz zzzzzz zzzzzz zzzzzzzzzzzz ]]> </someattr7> </someattr4> </someattrs> </object> With the xls transformation which is meant to...

How to modify multiple elements of a block with BEM CSS

css,block,element,modifier,bem
Let us say I have the following setup, .block .block__header .block__content .block__footer Now I want to show an active state of this block. Let us say the block itself gets a green background and element 2 and 3 should get bold text. As I understand the philosophy of BEM, one...

JAVA RMI get pass ArrayList element

java,arraylist,get,element,rmi
I have a server that contains an ArrayList in " ServerInfo " and when I try to take from ClientRMI an element of the ArrayList(in ServerInfo) for example adf.getSGM ( 0 ).incrementCount( ) ; "count" does not increase it's as if every time I call it instantiates a new class...

How to get element data field using jquery in nested form

jquery,html,element
This is jquery, code, it always returns ID = 1 when you click on "GENERAL" or inner section like "CSS ISSUES". While i am trying to get ID of the Li clicked. <ul id="faq_list" class="list-unstyled"> <li data-type="parent" data-value="1"> <a href="javascript:;">General</a> <div class="subdata" id="target_1"> <ul> <li data-type="parent" data-value="5"> <a href="javascript:;">CSS Issues</a>...

MeshGrid for Triangle Elements

matlab,element,contourf
I want to build a contourf plot of a certain aspect in my Plate. The plate is divided in triangle elements, which I have the coordinates (x,y) of each knot of the triangle. So, How can I make a meshgrid for my knots so I can make my contourf plot??...

Selenium can't seem to find and click a button on website? - Python

python,selenium,selenium-webdriver,find,element
I am trying to make software that automaticly collects data for me from fiverr.com website. It searches for specific term, and then it should press LOAD MORE button at the end of page, and keep clicking it until it loads all the 'gigs'. Anyway, I have good idea of how...

matlab find specific VALUES in an array

arrays,matlab,indexing,element
How to find out all array element indices equal to several values (>2) For example, I have an array a=[1 2 3 4 5 5 4 3 2 2 2 1], I want to know the indices of all elements equal to b=[2 5] Remember, I cannot use style like...