1

I am holding html text boxes in .aspx pages and want to pass the text box values into app.js file.

<tr>
  <td>Business Phone</td>
  <td><input type="text" id="txtbusinessphone" /></td>
</tr>

I had Written the below line in my app.js file ,But finding no luck to get the values.Can any one help me in solving this

var InterfaceElements = document.getElementById('<%=txtFirstname.ClientID%>').value;
1
  • Is this in a SharePoint-hosted app? – Rob Windsor Feb 16 '17 at 17:13
0

You're using some ASP.NET syntax that doesn't work in JavaScript.

If you want to get the value of the HTML input shown in your markup, the JavaScript code would be:

var phone = document.getElementById('txtbusinessphone').value;

If you were using jQuery it would be:

var phone = jQuery('#txtbusinessphone').val();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.