How to pass multiple prams to javascript function from anchor tag -
i have anchor tag having onclick event below
<a id="btnsave" href="javascript: void[0];" onclick="btnsave(id,email ,companyname,address)" /> function btnsave(id, email, companyname, address) { alert(id, "+", email, "+", companyname, "+", address); } in view storing these values in hidden field. unable values in btnsave function while clicking on anchor tag. please me solve this.
the onclick event handler function doesn't know id, email, companyname or address are. undefined variables @ point.
retrieve values of fields using document.getelementbyid() , querying value attribute, , pass them on function.
onclick="btnsave(document.getelementbyid('id').value, ...); return false;"
Comments
Post a Comment