I am doing some self-learning about JQuery and stuck over a question:
I am trying to use the JQuery next() API to grab the data from the Text Box field of Hidden type, but I failed to do so.
Here is my code:
$(document).ready(function(){
$(".Testing").click(function(){
var what = $(this).next().val();
alert(what);
});
});
<span class="Testing">Hello</span><br/>
<input type="hidden" value="World">
<span class="Testing">Hi</span><br/>
<input type="hidden" value="There">
Could you help me solve the question please?
Reference link:
Grab the ID of a SPAN tag and add some value to a Text Box Field according to which tag has been clicked
You probably forgot to close the call to $(document).ready.
It needs extra });