Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing the value inside an element #48

Open
computersrmyfriends opened this issue Jul 25, 2018 · 3 comments
Open

Replacing the value inside an element #48

computersrmyfriends opened this issue Jul 25, 2018 · 3 comments

Comments

@computersrmyfriends
Copy link

Hi,
Thanks for your wonderful lib.
I'm struggling with replacing the value inside a div.

Here's an example of what I'm facing:

<div>hello</div>
<div>world</div>

The div's don't have id or class. I just need to replace the hello with hi after selecting the div based on the content inside the element. I need to achieve this somehow. I would appreciate any help.

Thanks

@No9
Copy link
Owner

No9 commented Jul 26, 2018

Hey @computersrmyfriends
Trumpet that this library is built on supports a number of selectors
https://github.com/substack/node-trumpet#selector-syntax

simply 'div' should work

@computersrmyfriends
Copy link
Author

Yes but div would select both div's. I wanted to select omly the div having the value hello in it.

Thanks

@No9
Copy link
Owner

No9 commented Aug 18, 2018

Hi @computersrmyfriends
You would have to test for that in the func based on the properties of the node parameter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants