<form method='post'>
<input type='text' name='A'>
<input type='text' name='B' readonly>
<input type='text' name='C' class='CCC'>
<select name='D'><option value=''>Select</option></select>
<input type='text' name='E' class='first'>
<input type='text' name='F' class='first'>
<button type='submit' name='BTN'>click</button>
</form>
how to use jquery to find above different elements? so far i only know .prev() but sometime it return back to me NULL/object when i use a lot .prev() to climb up.
any good way to learn?!
Sorry, let me put more detail on what i wish to learn here.
1). my way to get value from A, when click on button
$(this).prev().prev().prev().prev().prev().prev().val()
should have more better way right!
2). how to find previous element which is readonly?
3). how to find or get value from previous element whihc have class ‘CCC’?
4). how to find or get different value which have same class of ‘first’? i know there is something like :first or second but i keep getting error code, when i write something like $(“input[class=’first’]:first”).val() / $(“input[class=’first’]:second”).val()
You can go to the
formelement, and find any field in it, for example: