KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is there any difference between these solutions? Solution 1: function doSomething(id, value) { console.log(value); //... } <input id="theId" value="test" onclick="doSomething(this.id, this.value)" /> ...and Solution 2: function doSomething(id) { var value = document.getElementById(id).value; console.log(value); //... } <input id="theId" value="test" onclick="doSomething(this.id)" />
Tags (comma-separated)
Save Edits
Cancel