Given I have object with a name property which is, say: 'Woodcutters Hut'. If I try to assign this to a button attribute:
$('#possible_constructions').append("<button name=" + object.name + ">" + object.name + "</button>")
The buttons writing is correctly the entire 'Woodcutters Hut' however the name attribute only consists of the first word 'Woodcutters'. and hut is displayed outside like so:
<button name="Woodcutters" hut>Woodcutters Hut</button>
Anyway to ensure the attribute is assigned properly?
name="Woodcutters_hut"using$('#possible_constructions').append("<button name=" + object.name.replace(/ /g, "_")+ ">" + object.name + "</button>")nameand text need to be the same? Why does the button need anamein the first place?