RenderResponse is a open source vanilla javascript library that gives you tools to render things/create elements like a list, paragraph, embedded paragraph link, and link lists. Uses JavaScript ES6
Lucky's GitHub | Contact Lucky
You can create an variable with an array of the info you want to display or use the functions parameters
newResponse(['question', ['response'], 'type', display]);
- true - displays the question
- false - doesn't display the question
- list - simple list for multiple responses
- embedLink - embedded link inside of p element
- link - simple link with name
- par - simple paragraph
- linkList - list of links with names
Whatever you want it to send back in the formatted form
What the formatted response is answering This can be displayed using the display argument, by typing true the question will be shown with the response
//using parameters
newResponse('What does math class sound like?', ['blah', 'blah', 'blah'], 'list', true);
//using variables
let response = ['What does math class sound like?', ['blah', 'blah', 'blah'], 'list', true];
newResponse(response);
What does math class sound like?
- blah
- blah
- blah
//syntax example
newResponse(['Question', ['text', 'linkTitle', 'url' ], 'embedLink', display]);
//real example
newResponse(['Wheres my shoes?', ['You can find my shoes', 'here', 'https://youtube.com'], 'embedLink', true]);
Wheres my shoes? You can find my shoes here
//syntax
newResponse('question', ['linkTitle', 'url'], 'link', true);
//example
newResponse('Wheres my supersuit?', ['Supersuit', 'https://youtube.com'], 'link', true);
Wheres my supersuit? supersuit
takes only one argument in answers
//syntax
newResponse('question', 'response', 'par', true);
//example
newResponse('Wheres my supersuit?', 'Probably downstairs, did you check the pantry?', 'par', true);
Wheres my supersuit? Probably downstairs, did you check the pantry?
//syntax
newResponse('question', ['linkname', 'url', 'linkname', 'url'], 'linkList', true);
//example
newResponse('I need some good websites', ['YouTube', 'https://youtube.com', 'Google', 'https://google.com'], 'linkList', true);
I need some good websites
You can use the customID to give it an id you want use to customize or us js to manipulate The customID doesn't have to be a pre-existing ID
//syntax
newResponse('question', ['img-title', 'src', 'customID'], 'img', display);
//example
newResponse('What does a dolphin look like?', ['Dolphin', 'images/dolphin.jpg', 'dolphin-img'], 'img', true);