If no ID then create a random ID

To make it easier to keep a selected element we deicded to grab the id and if there was no id then we inject a random id.