after remove tr from table with javascript when submit sends all rows

I hve a table in a html page, with a function it is possible to remove the selected row, but when i press the submit button all rows are submitted. if i see the source code i can see the html with all rows. this is the function i am using.

EDIT this is how the table look like.

after remove tr from table with javascript when submit sends all rows

this is the initialization code for the button to bind it with the function.

$(document).ready(function(){ $(".btnDelete").bind("click", Delete); });

this is the function that deletes the row.

function Delete(){ var rowCount = $('#datallesNota tr').length; console.log('FILAS EN LA TABLA: ' + rowCount ); console.log('ELIMINAR FILA: '); var par = $(this).parent().parent(); //tr par.remove(); console.log('SE REMOVIO LA FILA: ' ); };

this is part of the table where the function is called.

<tr id="1"> <td><button class="btnDelete"><img alt="QUITAR" src="/resources/img/16x16/delete.png"> </button>

Thanks for any help.

-------------Problems Reply------------

Here is a sample of removing a tr from table.


<table id="myTable">
<tr id="1">
<td>My Conten1</td>

<tr id="2">
<td>My Conten2</td>

<tr id="3">
<td>My Conten3</td>
<button class="btnDelete">Click Me</button>

$(".btnDelete").on("click", function(){
var rowId = 2;

function deleteRow(rowId){
var selectedRow = $("#myTable tr[id="+rowId+"]");

Category:javascript Views:780 Time:2015-03-19

Related post

  • how to remove and re-order cells in a table in JavaScript 2011-07-15

    As per question how could I remove empty cells and bring cells with data on top of the table in JavaScript/Prototype, basically all cells with data will be at the top and then empty cells should be removed. <table> <tr class="row"> <td

  • Saving data from a dynamic html table using javascript 2011-09-09

    I load data from a mysql table into a HTML table. Then the user can add or remove one or more rows. Finally I have to save the changes into the database. All this have to be done using PHP and javascript. I know this does not seem very hard. In fact,

  • How to disable and enable HTML table using javascript? 2011-10-26

    I want to know how can I disable and enable the highlighting on an HTML table using javascript by clicking an html button. Here are my codes: tabletest.html <html> <head> <script type="text/javascript"> function disableTable() { doc

  • add a to a table via javascript(jquery) 2012-03-17

    I have this PHP in my application, <table><tr> <?php if($music_interests !== FALSE) { $count = 0; foreach($music_interests as $interest) { ?> <td> <div class="interest inline"> <img src="<?php echo $interest['image

  • How to remove a property from a JavaScript object 2008-10-16

    Say I create an object thusly: var myJSONObject = {"ircEvent": "PRIVMSG", "method": "newURI", "regex": "^http://.*"}; What is the best way to remove the property 'regex' to end up with this new myJSONObject: var myJSONObject = {"ircEvent": "PRIVMSG",

  • How to add a TableRow/TableCell to an ASP.NET table from Javascript? 2008-11-18

    What is the best way to dynamically add TableRows and TableCells to an ASP.NET table from Javascript? Thanks, Jeff --------------Solutions------------- Your question is too vague to answer completely, I'm afraid. If you actually want to create TableR

  • Hash table in JavaScript 2009-01-19

    I am using a hash table in JavaScript, and I want to show the values of the following in a hash table one -[1,10,5] two -[2] three -[3, 30, 300, etc.] I have found the following code. It works for the following data. one -[1] two -[2] three-[3] How d

  • Create clone of table row and append to table in JavaScript 2009-11-13

    In JavaScript, how can I add a row dynamically to a table? On a JavaScript event I want to create a similar row and append to the table. --------------Solutions------------- If you don't wish to use jQuery there are a couple of simple functions you c

  • how to create a table with javascript? 2009-11-25

    I have this php function, which I want to convert to javascript function, but I don't know how to create a table in javascript. I guess I have to have a container (DIV) to insert the table into with javascript. Here is the php function simplified: (i

  • How do I sort a hash table in javascript? 2010-05-08

    I have a javascript hash table, like so: var things = [ ]; things["hello"] = {"name" : "zzz I fell asleep", "number" : 7}; things["one"] = {"name" : "something", "number" : 18}; things["two"] = {"name" : "another thing", "number" : -2}; I want to sor

  • Does remove a DOM object (in Javascript) will cause Memory leak if it has event attached? 2010-06-08

    So, if in the javascript, I create a DOM object in the HTML page, and attach event listener to the DOM object, upon I remove the the DOM from HTML page, does the event listener still exist and causing memory leak? function myTest() { var obj = docume

  • Disable table in javascript 2010-06-10

    I have many controls in table and I want to disable all the controls using JavaScript upon clicking of some checkbox. I have google and found that we can't disable table instead all controls through loop. Please suggest me, what is better idea Thanks

  • How do I get data from a data table in javascript? 2010-07-14

    I would like to pull data (string) from a column called "Limit" in a table ("displayTable") in javascript. How do I do that? var table = document.getElementById('displayTable'); var rowCount = table.rows.length; for (var i = 1; i < rowCount - 1; i

  • Remove illegal URL characters with JavaScript 2010-08-15

    I have an array filled with strings, a value can for example be "not updated for > days". I use the values in the array to create some url's and need to remove the /\<> and other illegal URL characters. How do I easiest do this? I started wi

  • Adding rows in HTML table using javascript 2010-09-17

    I am trying to insert rows into an html table with javascript. I have the table created and can add rows successfully with the click of a button. However, I want to be able to populate the rows with elements from several arrays on load. The button is

  • Select text in html table with Javascript 2010-12-23

    I have an HTML table with a "select_tag" field and I want to have another field that receives the option selected then multiply by another number for the price to display the total. Here is the table: <table> <tr> <td>(select_tag)

  • How would I put words from a string into a table in Javascript? 2011-04-26

    i am new to programming and i have been given an assignment. the task is: "place the words in the string "tx_val" in a table with a one pixel border, with a gray backgound. Use only three cells per row. Empty cells should contain the word "null". " i

  • Is there a way to completely remove an HTML element using Javascript? 2011-04-29

    Is it possible to remove/delete an HTML element from the markup directly using Javascript/jQuery/Ajax instead of using CSS display: none? --------------Solutions------------- Yes JavaScript var parent = document.getElementById('parentElementID'); var

  • How to remove an HTML element using Javascript? 2011-05-09

    I am a total newbie. Can somebody tell me how to remove an html element using the original javascript not jQuery. index.html <html> <head> <script type="text/javascript" src="myscripts.js" > </script> <style> #dummy { mi

Copyright (C), All Rights Reserved.

processed in 0.093 (s). 11 q(s)