1

I have inserted into my Home.aspx a list with Web-Parts like this:

enter image description here

Now I want to know how can I apply JavaScript to this list?

Note: I want to display an image depending of selected of one field

2

You can apply JavaScript to your list by using Script Editor Web-part(SEWP)

enter image description here

Step 1: Edit the list page from top right gear/edit page.

Step 2: Add new web part and add a Script Editor to the page, under Media and Content.

Step 3: Add your JavaScript code.

  • When I press media and Content it don´t show me "Script Editor" Tab – Ledwing Aug 28 '17 at 15:18
  • You can use a Content Editor Web Part and do the same thing. Also, it is better practice not to write you code directly into the editor. Use the web part to reference a .js or .txt file with your code in it. – lazoDev Aug 28 '17 at 15:26
  • It dont appears because I don't have right permissions, there is how to activate it Activate script capabilities – Ledwing Aug 28 '17 at 15:42
  • Now a question. As I can see when we add an Script Editor it appears into web page. When I publish it, it appears or it hide? – Ledwing Aug 28 '17 at 15:43
  • When you save your Script Editor will be hidden. – Youssef Moumen El idrissi Aug 28 '17 at 15:59
0

Your screenshot looks like the Classic view. For this view you can use Client Side Rendering (JS Link) either for the field itself or for a List View Web Part (on a classic page).

In a modern view, you'll need to use a SharePoint Framework Field Customizer. However, these are still in preview and likely won't be available outside of developer tenants until the end of September or later.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.