I am very beginner to HTML and javascript, so looking for some help. I have a form and it has a submit button. When i click on the submit button the name of the button will change and it will do some action. when i click on the button again i have to do different actuion. Here is my code.
HTML:
<form name="myform" method="post" onsubmit="return false">
<input type="submit" id="reschedule" value="reschedule" onclick="changeContent()"/>
Javascript is :
function changeContent(ref){
alert(id)
document.getElementById("reschedule").value="Submit"
var editables = document.getElementsByClassName('editableText');
for (var i = 1; i < editables.length; i++) {
var newstate = !editables[i].isContentEditable;
editables[i].contentEditable = newstate;
editables[i].bgcolor='#FF0000'
}
if (document.getElementById("Submit").click) {
alert("submit")
}
}
So when i click on reschedule the button name will change to submit. Now when i need to click on submit function i need to do some action. How can i do this.
submitbutton the page will get refreshed and it wont meet your requirement. try replacing withbutton