Мар
2
2015
2
2015
JavaScript // jQuery /
javascript получить name и value из input
Возникла задача обрабатывать динамически создаваемые input. И вносить их значения в базу.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){ var id_value = $(':text').map(function(i, el){ return $(el).attr("name")+'-'+$(el).attr("value"); }).get(); alert(id_value); }); </script> <style> p { color:red; } </style> </head> <body> <p><b>Values: </b></p> <form> <input type="text" class="brand-panel-show" name="name" value="John"/> <input type="text" class="brand-panel-show" name="password" value="password"/> <input type="text" class="brand-panel-show" name="url" value="http://ejohn.org/"/> </form> </body> </html>