Awarious OfficePortal - HRMS Application

JQuery selector to find element by name inside a form element

0 votes
asked Jul 26, 2014 in JQuery by anonymous

I have a from element which has a hidden field with name 'code'. My webpage my contain multiple form elements and each form element will have hidden field with the same name. I want to find the value of a hidden field which is inside a particular form. How do I find it?

<form id="myform" method="POST" action="">
    <input type="hidden" name="code" value="1-1406394571-b80d90865365921f3048bfb591d07cf0b0c48ee7">

1 Answer

0 votes
answered Jul 26, 2014 by Aadhira (1,215 points)

Since your form has an Id, you can use ID selector and attribute selector together to get the value of hidden field as below.

code = jQuery('#myform input[name="code"]').val();

Your answer


Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
site design / logo / content © 2013 - 2019