I have a script tag in a web-page which contains a function updatevalues(value) . I need to add code into that function using another javascript tag.
I am able to similarly write into other html elements by using getemementbyid.innerHTML...
How can i add code inside a JS function using another JS tag?
My current code is:
<script>
function updatevalues(value){
var a=1;
}
</script>
I want to make it like this:
<script>
function updatevalues(value){
var a=1;
var b=2;
}
</script>
You don't need to edit the previous <script>
. Literally just write this in a new <script>
:
function updatevalues(value) {
var a=1;
var b=2;
}
And it will override the definition of the same function in the previous script.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.