Feb 26 2019 01:41 PM - edited Feb 26 2019 02:03 PM
I am creating my first simple web part that will modify a div. I want to find the div by giving it a unique ID. As it is possible for a user to put more than one of my web part on a single page, how do I make the div's ID unique to each web part instance?
I am creating the web part using the SharePoint Framework using the tutorials found at:
https://www.youtube.com/channel/UC_mKdhw-V6CeCM7gTo_Iy7w
Feb 26 2019 01:49 PM - edited Feb 26 2019 02:17 PM
SolutionHi @smithme
sure you can create and assign a Guid
var guid: Guid = Guid.newGuid();
importing
import { Guid } from '@microsoft/sp-client-base';
Cheers,
Federico
Feb 26 2019 02:05 PM
I failed to mention that I am using the SharePoint Framework with Visual Studio Code. I modified the original post to try and clarify my question.
Feb 26 2019 02:28 PM
Thanks for your help.
Side note:
I didn't need the import line as the Yeoman scaffolding already included it for me (something I never noticed before) with this line of code:
import { Version, Guid } from '@microsoft/sp-core-library';
Feb 26 2019 01:49 PM - edited Feb 26 2019 02:17 PM
SolutionHi @smithme
sure you can create and assign a Guid
var guid: Guid = Guid.newGuid();
importing
import { Guid } from '@microsoft/sp-client-base';
Cheers,
Federico