Find code in string by hovering on rendered HTML element? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 days ago.
Improve this question
I'm trying to build custom Inspect Element, like browsers dev tools has.
It sounds simple:
You have string of code, like:
<h1>First header</h1>
<h1>Second header</h1>
Render this string in page.
Hover over second header.
How to get right position of <h1>Second header</h1> in the string?
Maybe I need to
Parse string to AST,
Add ID to every element.
Render a new version with ids.
Okay, we have right id of the element. But we need to find its position in string, not AST.
Anyway, how to solve this simplier? Also how can I do that for CSS/JS as well?

Related

Get the closest iframe to a parent element [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
i am trying t get the closest iframe element to a parent element so can identify the iframe that i want to stylize with css:
<div class ="accroche">
<iframe></iframe>
<iframe></iframe>
<iframe></iframe>
<iframe></iframe>
</div>
What would be the best technique knowing that the iframes are generated by another tool and there is no way to identify them
Well if I understand your problem it’s the first element of the list so you can do something like that in your css to style it :
.accroche iframe:first-child{ … }

How to get the page title from Wikipedia page URL? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm trying to create a system where the user will input their Wikipedia page link, and the application will get the page title from Wikipedia page URL.
Like, if the user gives: https://id.wikipedia.org/wiki/Eminem, I want to get the page title Eminem.
Or if the user gives: https://id.wikipedia.org/wiki/Eminem#1992%E2%80%931997:_Awal_karier,_Infinite_dan_masalah_keluarga, I want the page title, which is Eminem
I've tried finding a regex pattern. I'm thinking about what if I could create/ find a regex pattern that would find words that sit between /wiki/ and ends with a /. So far didn't found any way to do that.
So what can I do? What other options I have?
this would partly work: /(?<=https?:\/\/..\.wikipedia\.org\/wiki\/).+(?=\/(.+)?|#)/
It doesn't work without a / at the end though.

How could I create a graphic with nodes that contain links? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'd like to use HTML, CSS, and JavaScript to create a menu that looks like so:
Each Chapter has a little "node" to the left of it that when clicked would bring the user to that chapter's dedicated web page. Is this something that could be done using canvas elements in HTML?
You could create the images for the bullets and then use the list-style-image property when styling list. You can then use JavaScript to keep track of the state. Assign the appropriate image based on what the user has clicked.
If you need a sample of the code to get this working let me see how far you get then I can add pointers.
CSS list-style-image

Get HTML <input> value in Java [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I've searched arround on Google but couldn't find a clear answer on my question. The idea of what I want to do is quite simple:
There's a site called "glws.org" with a bunch of <div>'s and <input>'s on the page. You can add strings to the URL (example: https://glws.org/#S76561198105687636A2280482163D16883436630920468625) and for different strings after the # in the URL, different values are put into the <input>'s. The site reads the string after the # and has a script that converts it into values and puts the values in read-only <input>'s. Because they are <input>'s and not <p>'s for example, I can't just read them by printing out the HTML code.
Is there a way to retrieve the value in the input fields through a Java program? I've tried to read the source code of the page with Sockets but that obviously just prints the <input> tags without the value because it's not like a <p> or something.
Any help is appreciated!
You can use Selenium web driver to do browser actions on the website programatically and wait till some elements appear on the page.
https://code.google.com/p/selenium/wiki/GettingStarted

How to track the selected text and mark it? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to know:
with some of what position people select the text
and add text around it full of tag with his class.
Wherein:
report should be based on HTML tags
without such as span and link (a)
Example:
I marked this as a duplicate but the comment afterwards meant a response may be needed.
If you look at the only answer here: Get the highlighted text position in .html() and .text()
you will find that there is mention of
Reference
.wrap()
.before()
.after()
You should be able to use those along with the second part of the answer to add in any tags you want to the selected text.

Categories