OK I am sure I am doing something simple fundamentally wrong but am unable to resolve this issue on my own. I have tried googling and searching this forum and reading through the relevant parts of the jquery documentation.
If you need any further information please let me know. Many thanks in advance.
What I am trying to do:
I have a table showing details of various tests at the bottom of which I have a button to ad a new test. As each test comprises several rows of the table I have a template in a hidden div which I have cloned and appended to the live table. I am the using jquery to add appropriate classes and ids based on a variable integer for the sake of uniqueness. I am also attempting to add a click event to an image within one of the table cell to delete the rows relating to that particular test.
My current function
function newTest(sampleID){
var testID = $("#testCount").val();
$("#newTest tr").clone(true)
.addClass("test"+testID)
.appendTo("#testsTable"+sampleID);
$(".newdelbox:first")
.attr("id","testDelete"+testID)
.addClass("delbox")
.removeClass("newdelbox");
$(".test"+testID).on('click',"#testDelete"+testID,delSample(testID));
testID++;
$("#testCount").val(testID);
}
What I need to happen
Function to be called when image is clicked.
What is happening
Function is called only when script is assigned (not clicked). Function will not subsequently run when clicked. I am seeing no errors within the console.
What I have tried
chained to preceeding code:
.click(delSample(testID));
.on("click",delSample(testID));
.bind("click",delSample(testID));
As new line within function:
$(".test"+testID).on('click',"#testDelete"+testID,delSample(testID));
document.getElementById("testDelete"+testID).onclick(delSample(testID));
document.getElementById("testDelete"+testID).addEventListener("click",delSample(testID),false);
try this:
.click(function(){
delSample(testID);
});
OR
.on("click",function(){
delSample(testID);
});
I'm trying to accomplish the following with Jquery: When the "No Top" radio-button is "checked" it should disable and "uncheck" any selection done in the Checkbox selection. If the user select ...
I'm trying to accomplish the following with Jquery: When the "No Top" radio-button is "checked" it should disable and "uncheck" any selection done in the Checkbox selection. If the user select ...
I want to create paragraph dynamic,so I wrote the following code. After user click the button, a new paragraph whose innerText is the user's inputs should be added.But I failed, Is there someone can ...
I want to create paragraph dynamic,so I wrote the following code. After user click the button, a new paragraph whose innerText is the user's inputs should be added.But I failed, Is there someone can ...
I'm trying to create a news style marquee at the bottom of my XSL page that shows some information it retrieves from an XML file. What I want it to do is automatically refresh the content of only this ...
I'm trying to create a news style marquee at the bottom of my XSL page that shows some information it retrieves from an XML file. What I want it to do is automatically refresh the content of only this ...
I have an array of letters and numbers. let sortLetters = [ 'R', '1', 'U', '1', 'N', '1', 'D', '1', 'M', '1', 'C', '1' ] I want to sort the types alphabetically, then return the first letter I come ...
I have an array of letters and numbers. let sortLetters = [ 'R', '1', 'U', '1', 'N', '1', 'D', '1', 'M', '1', 'C', '1' ] I want to sort the types alphabetically, then return the first letter I come ...