I have this div
<div ui:field="myText" class="{style.myText}"> </div>
Node x = divText.getChild(selectText.getSelectedIndex()-1).getFirstChild();
In node x i am getting the exact text i am looking for, but now i want to make some changes with that text, like change the color of that text only,
I do not want to change the color of my div, i want to change the color of some specific Node in my div
is there some way i can achive this.
Thanks
Related
I want to get the text inside the element that comes after a certain text ie. 'Projected earning growth'. I want to get the value 18.10% . The pattern I want to follow is lookup for a certain text as above, and then get the text following the immediate h2 element.
Is it possible to have one xpath expression that will do both the steps together?
Match the div for a certain text 'Projected earning growth'
Go to the immediate h1 element outside the div (I have to jump two divs here to get to the h1 element)
How do I match for a text and get to the next immediate h1 element via xpath?
<div>
<div class="p small mb-8 box-label text-left text-blue-500">
<div class="tt-container">
<button aria-label="open tooltip" class="button link" type="button" role="tooltip" aria-expanded="false">
Projected earning growth
</button>
</div>
</div>
<h2 class="mb-8 text-left">18.10%</h2>
</div>
If I understood you correctly, you want to go from Projected earning growth to 18.10% which is in h2 tag. Not sure why you've mentioned h1 tag though.
//button[contains(text(),'Projected earning growth')]/../../following-sibling::h2
should get the job done,
Note that /.. to go to go level up in HTMLDOM.
This is straight up solution to the problem that you are having.
I would also suggest you to have a look on xpath parent and ancestor.
I have an HTML that includes 2 paragraphs:
<p style="text-align: center">centered text example</p>
<p style="text-align: right">alignment right text example</p>
I added it in my android TextView using Html.fromHtml
As a result in my view first paragraph aligned center(as expected), but second paragraph doesn't aligned rigth and aligned to left.
How is it correct to set html alignment properties to make work it in android?
That is because for some reason Html.fromHtml supports start, center and end as text-align values. It does not match CSS, but that's how it works.
Proof
change
"text-align: right"
to
"text-align: end"
in your inline css
Try using
"text-align: end"
instead of
"text-align: right"
I have a radio choice form which is generated with the RadioChoice component in wicket. Here <span/> covers all of the possible choices in the form. I want the span to go downwards. One option per row on screen, but I am currently stuck with the problem that if i try to style choice it get styled as one. For example, if i try to take border: 1px solid red; it creates only one border, and not one for each choice.
<form class="mapSelector" wicket:id="radioForm">
<span class="choice" wicket:id="radio"></span>
</form>
I am not sure I understand what you mean with I want the span to go downwards. One option per row on screen but it sounds like you need a <div> instead of <span>, i.e. an element with display:block.
I am not sure how CSS border is related to downwards and row.
I'd suggest you to see what is the generated HTML because this Wicket Component may generate <label> too for each radio element.
So, say I have this HTML block here: (this is Java JSOUP BTW)
<div class="menuitem"> <span class="ul">Creamy Broccoli Cheddar Soup</span><img class="icon" alt="Vegetarian">
Right now I have a list of elements (as Elements type) and I want to select the elements, but only ones that have an attribute as "Vegetarian" in the alt="" part of the img tag within it.
Right now I can select based on if it's Vegetarian for example by doing
meals.select("img[alt=vegetarian]")
but this only returns the actual img tags as elements, thus losing the name of the object (which is Creamy Broccoli Cheddar Soup in the above example)
How do I select the div part of the element but still make sure the img tag within has a certain attribute?
Thanks
Iterate over all the div elements of class menuitem, and check at each iteration if meals.select("img[alt=vegetarian]").size() > 0.
I am using contenteditable attribute in this way.
${row.pno}.
As the data is retrieved from the DB, few values can be null. I can edit the span with some value. The problem is I cannot edit the blank(null text) span. How can i achieve this.
Thanks and Regards
Adeeb
An element with the contenteditable attribute is editable even if the element is initially empty, as in <span contenteditable></span>. The user just can’t focus on it by clicking on it. But he can use the TAB key to move to the element and then type or paste something.
The conclusions depend on the context. For example, if the span element is the sole content of a table cell, you could set display: block on it, making it occupy the entire. Assuming that other cells imply nonzero width and height for that cell, the editable element would have them too and be clickable.