Since the value parameter has characters that are not read, such as the " " where the value is found where it is encountered, I tried to pass in the URL in reference to the decodeURI value but it doesn't work.
Can you kindly help me with this?
<a href="updatebook.html?id=${item.id}&number=${item.number}&value=decodeURI${item.value}">${item.type}</a>
You have 2 problems with your code.
The first is that you are using decodeURI function but you should use encodeURI function.
The second problem is that you are not calling the function, you forgot the ( and ).
Update:
As pointed out by @deceze, the third problem is the function call needs to be inside the ${}.
All put together, it should be:
const item = {
id: 1,
value: 'https://stackoverflow.com?q=hello world',
type: 'bar'
};
let link = `<a href="updatebook.html?id=${item.id}&number=${item.number}&value=${encodeURI(item.value)}">${item.type}</a>`;
console.log(link);