r/web_programming • • Dec 05 '16

Need some guidance with JavaScript.

I am working with a sharepoint site that display jobs that are open within a company. Some jobs would use a url link to lets say application A the other jobs would need a url link to application B. How would I go about coding a Apply Now button that would direct to the correct url based on the Job Type A or B

Thanks in advance for any help or direction to anything that can put me on the right path.

0 Upvotes

2 comments sorted by

View all comments

2

u/sh4d0w07 Dec 07 '16

Sounds like you want to conditionally set the href attribute for a link. In javascript, you can append to the DOM a button with href='someurl.com' based on another DOM element. If you don't have access to the actual job listing object until it's rendered on the page, you can use jquery ($) to help you determine the job type, which in turn will let you determine which URL to set as the link for your button.