Suppose I have UI like it:
<script>
var someFunction(){
//some code to validate and then send message
}
</script>
Message:<br>
<textarea></textarea><br>
<input type="button" id="submit" value="Submit" onclick="someFunction()"/>
Which a submit button calls someFunction() to validate and then send messages to server. I know someFunction is not a good name for name, but I don't know which naming principle is better: Should the name be:
1.Relate to which button to use:
var onSubmitPressed(){
//some code to validate and then send message
}
2.Relate to the task of the function:
var validateAndSendMessage(){
//some code to validate and then send message
}
which one is better?