How can I convert this text into a link?


Badge +5

I get the below text from a variable (location of attachment). How can I convert this into a link, so when a user clicks on the name, in this case Chrysanthemum.jpg that it open the attachment?

Chrysanthemum.jpg<a href="https://mysite.com.au/sites/busapps/payrollallowance/Lists/Payroll%20Allowance%20Master%20List/Attachments/431/Chrysanthemum.jpg" </a> <br>


3 replies

Badge +8

Hello Abhi Pathania​,

If I'm understanding your question correctly, your syntax is just a little off in order to be well-formed HTML and create a clickable URL. Here's what you'd need:

<a href="https://mysite.com.au/sites/busapps/payrollallowance/Lists/Payroll%20Allowance%20Master%20List/Attachments/431/Chrysanthemum.jpg">Chrysanthemum.jpg</a>

You'll notice the hyperlink's title "Chrysanthemum.jpg" moved inside the <a></a> tags.

Badge +5

Hi Patrick,

Thanks for your prompt response.

How do you suggest I handle, when I get the results as :

Desert.jpg<a href="https://mysite.com.au/sites/busapps/payrollallowance/Lists/Payroll%20Allowance%20Master%20List/Attachments/433/Desert.jpg" </a> <br>Hydrangeas.jpg<a href="https://mysite.com.au/sites/busapps/payrollallowance/Lists/Payroll%20Allowance%20Master%20List/Attachments/433/Hydrangeas.jpg" </a> <br>Jellyfish.jpg<a href="https://mysite.com.au/sites/busapps/payrollallowance/Lists/Payroll%20Allowance%20Master%20List/Attachments/433/Jellyfish.jpg" </a> <br>

Badge +5

Thanks Patrick, your suggestion helped a lot. I recreated the links as advised.

Now, will try to get these to open in a new window individually.

Thanks

Reply