473,403 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Onblur event in dynamicaly adding text fielsd in html table

I have a table,in that 2 input fields in each row,I want to get the value of first input field leters capitalised to secon tnput field on out of fociss from the first fieing
and want to add rows dynamicaly and haing the event on that rows also
Aug 29 '18 #1
2 1610
gits
5,390 Expert Mod 4TB
what have you tried so far? please post the code that you have problems with.
Aug 29 '18 #2
Expand|Select|Wrap|Line Numbers
  1. <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  2.   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
  3.   <script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>
  4.   <script src="https://cdn.datatables.net/1.10.15/js/dataTables.bootstrap.min.js"></script>
  5.   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.css" />
  6.   <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js"></script>
  7.   <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
  8.   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
  9.   <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  10. <table id="item_table">
  11. <tr><th>SL No</th><th>Name</th><th>Capitalised</th><th><button type="button" name="add" class="btn btn-success btn-sm add" >add</button></tr>
  12. </table>
  13.  
  14. <script>
  15. $(document).ready(function(){
  16.     $(document).on('click', '.add', function(){
  17.       var html = '';
  18.       html += '<tr>';
  19.        html += '<td><input type="text" name="slno[]" /></td>';
  20.       html += '<input type="text" name="name[]" id="name[]" onblur="capitalise()" />';
  21.       html += '<td><input type="text" name="capitalised[]" id="capitalised[]" /></td>';
  22.      html += '<td><button type="button" name="remove" class="btn btn-danger btn-sm remove" >Remove</button></td></tr>';
  23.       $('#item_table').append(html);
  24.      });
  25.  
  26.      $(document).on('click', '.remove', function(){
  27.       $(this).closest('tr').remove();
  28.      });
  29. });
  30. function capitalise(){
  31.     var a=document.getElementsByName("name[]")[0].value;
  32.     var b=document.getElementById("capitalised[]");
  33.     b.value=a.toUpperCase();
  34. }
  35. </script>
Aug 30 '18 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: bubbles | last post by:
i have a HTML file and it already has a HTML table and a few rows created by default.. however, i would like to add more rows to this table programmatically may i know how?
2
by: D. Alvarado | last post by:
Hi, I'm having some trouble with the "onBlur" event in the BODY tag. Ideally, what I want to happen is that when someone leaves window A, window A executes a command. I had put <body...
4
by: Peloux | last post by:
Hi, I have written some htc in order to validate data in a form. most of htc are attached on 'onblur' event. Now, we would like to use the Enter Key to sublit form, so we use the following...
1
by: suresh_nsnguys | last post by:
Hi, i am displaying google.com website inside a frame with frameset setting onblur="self.focus();". but when i am trying to enter some text in google search box,the text is not getting...
7
by: laredotornado | last post by:
Hi, Using the onblur handler in a text field, how can I check if the value was changed from what was originally there prior to the user focussing on the text field? Thanks, - Dave
2
by: John Kotuby | last post by:
Hi all, I am integrating some 3rd party grids into a large ASPX form page in VS 2008 using VB. I have 4 different grids on the page. The object is to not allow the user to leave a grid if...
3
by: btreddy | last post by:
Hii, In one of my form i've textboxes and a button,Close, which closes the form .In the OnBlur event of the text boxes im calling the javascript function which alerts the user if the textbox is...
9
by: aashishn86 | last post by:
Hi!! i want to validate a list box onthe onblur event and if no value is selected , display a message on the left using <span> and innerHTML here's what i have written <html> <head>...
1
by: gavish | last post by:
Hi all I want to add vertical scroll bars in table but I want its header not to move.Means header should be fixed and only data part will have scroll bar.....reply me as soon as possible.
1
by: 40david | last post by:
Hi, I'm pretty new to javascript,Ajax, DHTML so you'll have to forgive me.... I have some code that creates a table row dynamically. The table row and associated cells creates without issue. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.