Simple implementation of jquery via name attribute

  • 2021-06-29 06:18:57
  • OfStack

Simple implementation of jquery via name attribute


alert($("input[name='inputTest']").val()); 
 alert($("input[type='text']").attr("id")); // This is fetch id The value of, easy to remember, is written here 

$("input[name='inputTest']").each(

function(){

alert($(this).val());

}

) 

alert($("input[name='inputTest']")[0].value);

alert($("input[name='inputTest']")[1].value);

alert($("input[name='inputTest']").get(0).value); // You can also get the value here, which is the same as the two lines above 

alert($("input[name='inputTest']").get(1).value);

Related articles: