Knowledge Walls
John Peter
Pune, Maharashtra, India
How to assign dynamic values to textbox using JQuery val() function
Assign value of title attribute of textbox to value attribute. This is taking the title value to value of each textboxes.
<input type="text" title="Username" /> <br />
<input type="text" title="Password" /> <br />
<input type="text" title="Age" /> <br />
//This is the smart way to title attribute value to value of textbox
$("input[type=text]").val(function() {
      return $(this).attr("title");

//Otherwise using $.each in Jquery
Previous Topics
Previous lessons of current book.
Computer software engineer articles of One day One Thing to Know
Best Lessons of "One day One Thing to Know"
Top lessons which are viewed more times.
  Copyright © 2014 Knowledge walls, All rights reserved
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details