FAQ Database Discussion Community


Class name to find nested tagname and assign value in Javascript

javascript,getelementsbytagname,getelementsbyclassname
I have the following markup which I can't modify: <li class="campID"> <label for="input_2_14">Name</label> <div> <input name="input_14" id="input_2_14" type="text" value="" class="medium" tabindex="11"> </div> </li> I want to select the input and change its value using vanilla JS (assume jQuery is not available). I can't use the input name or ID as...

Get elements 'tag name' by searching Class name

javascript,html,getelementsbytagname,getelementsbyclassname
I'm trying to get element tag name which is associated with the element with a certain class name. I know I can do these two lines of code to get the class name and the tag name. document.getElementsByTagName("regeneratePostnatal"); document.getElementsByClassName(returnedPatientID); I'm just asking if there is a way of doing something...

PHP getElementsByTagName Scraping Links on Webpage Need to Determine if they contain Img elements

php,dom,domdocument,getelementsbytagname,getattribute
So I'm building a custom scraper for a project. I can currently scrape all of the links on a webpage, storing the HREF and anchor text in a database. However I am getting stuck when trying to determine if the anchor element contains and image element. Here is my code:...

Is there a way to get all input field names for a html form without having to go through manually?

javascript,html,google-apps-script,google-apps,getelementsbytagname
I have a happy new html form to write data into my Google spreadsheet, but now I need to set up the spreadsheet to receive the data. I want to do that using a loop to assign the data to the proper header (because it seems like a better method...

Does GetElementsByTagName() return value on-the-fly?

c#,winforms,webbrowser-control,getelementsbytagname
I have some question about internals. Does GetElementsByTagName() read all the elements requested store on an array and return it or return the value on-the-fly (like using yield)? I hope it's clear

Changing text in several table cells with external javascript

javascript,for-loop,getelementsbytagname
I have a calender type deal that I am trying to create and I am hung up on selecting and changing several <td> elements in one go. I plan on using a for loop to accomplish this by traversing each node and modifying its text each iteration, but I am...

XMLDoc GetElementsByTagName Only First Entry

php,sql,xml,xpath,getelementsbytagname
I am creating an XML to SQL file using php but only want my script to process the first entry in the XML document $xmlObject = $xmlDoc->getElementsByTagName('PlaylistEntry'); inputting the specific path that I want /Playlist/PlaylistEntry[1]/Title[1]/text() does not produce results. Any advice? edit: $xmlDoc = new DOMDocument(); $xmlDoc->load("file.xml"); $mysql_hostname = "";...

How to getElementsByTagName when elements are prepared for being an array in their name

javascript,jquery,getelementsbytagname
I'm trying to get an array of elements with javascript or jQuery when the elements I want are a set with the same name prepared for being an array once I submit the form. Much more understandable with the code: <form> <!-- ... --> <input name='ciudades[]' id="cb_0" type='checkbox' style="display: none"...

how can I get the value by tagnames in php?

php,domdocument,getelementsbytagname
could you give a suggestion to my code , please ? $string = "<li>CIs = <a href="http://localhost/itop/web/pages/UI.pdomhp?operation=details&class=FunctionalCI&id=49&c[menu]=ConfigManagementOverview" title="Functional CI::49">Sep Console04</a>, 42 49, Sep11, Sep Console04<br/><a href="http://localhost/itop/web/pages/UI.php?operation=details&class=FunctionalCI&id=50&c[menu]=ConfigManagementOverview" title="Functional CI::50">Sep Console05</a>, 42 50, Sep11, Sep...

javascript getelement where value contains specific string

javascript,html,getelementbyid,getelementsbytagname,getelementsbyclassname
I was wanting to count the occurrences of input fields that has a class name of text where that text input contains a specific value. document.getElementById('c_files').getElementsByClassName('text').length; So far this counts all textboxes with the class name of text but how can i make it value specific, say if i have...

Is it possible to make querySelectorAll live like getElementsByTagName?

javascript,dom,css-selectors,getelementsbytagname,queryselectorall
getElementsByTagName() has 2 great features: it is fast and it is live. But what if I want to get p strong. Of course I could refine a selection using getElementsByTagName() again but wouldn't I loose the live effect for the new p tags? Is there a way to turn querySelectorAll...