tatootianrocks
New Member
I am learning jqery. I am no ninja at it. After reading the following tutorial at W3Schools, I wanted to try something difficult. So i modified their sample a little bit wrote this :\[code\]<!DOCTYPE html><html><head><script src="http://stackoverflow.com//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script><script>$(document).ready(function(){ $("button").click(function(){ for(i=1;i<7;i++) // Getting the values from the input boxes { var a = $("#test"+i).val(); } for(i=1;i<7;i++) //printing the values in the document { document.write("<p>"+a+"</p>"); } });});</script></head><body><p>Name: <input type="text" id="test1" value="http://stackoverflow.com/questions/14445928/Mickey Mouse"></p><br><p>Name: <input type="text" id="test2" value="http://stackoverflow.com/questions/14445928/Mickey"></p><br><p>Name: <input type="text" id="test3" value="http://stackoverflow.com/questions/14445928/Mouse"></p><br><p>Name: <input type="text" id="test4" value="http://stackoverflow.com/questions/14445928/Micse"></p><br><p>Name: <input type="text" id="test5" value="http://stackoverflow.com/questions/14445928/Mice"></p><br><p>Name: <input type="text" id="test6" value="http://stackoverflow.com/questions/14445928/use"></p><br><button>Show Value</button></body></html>\[/code\]Here in the line \[code\]var a = $("#test"+i).val();\[/code\], is this possible. I mean using "\[code\]+\[/code\]" sign for identifying the id. ?The code is not working. It should show all the inputs made in the feilds on the html page. But it is not showing any response. Is there any mistake i did which jquery don't supports ?