I'm using WKWebview in my IOS Application.
I'm using:
bookingView.evaluateJavaScript("document.getElementById('nearbyLink').style = 'display:none';") { (response, err) in
if let err = err{
print(err.localizedDescription)
}
}
to remove a specific element by it's ID (This works fine!), but somehow this does not work on all elements.
I'm trying to remove another element by its class name using document.getElementsByClassName()
but it's still not being removed.
I've tried to remove the elements using this how to hide html elements in wkwebview in IOS? but still doesn't work.
Is there any other way I can remove objects in WKWebview?
So let's say I wanna remove a link like:
<form class="sort-options">
How can I change the code and add like this:
<form class="sort-options" style="display:none">
The webpage is not owned by me!