<script>
var addSubReddit = function(topicName){
console.log(topicName)
//add it to the list of existing subreddit topics
}
</script>
<form>
<input placeholder='Create new subreddit' value=''>
<button type='submit' onclick="addSubReddit(....)">Create</button>
</form>
How to access the input element's text value and pass it as a string value to button's onclick function?