what is the main reason that we cannot access the element from its name attribute rather it can be accessed from id attribute
<input type="text" name="textname" id="textid" value="">
<input type="button" name ="buttonname" id ="buttonid" value ="button"
$(document).ready(function(){
$("#buttonid").click(function(){
$("#textname").val ="text1";//doesnot work
$("#textid").val ="text1";
});
});