I am working on a classic asp page. The page is an admin page and needs to add and delete records from a recordset. I used a vbscript loop to print the table which looks like:
Do While Not commentRS.EOF
Response.Write "<tr><td><button type='submit' class='delete' name='delete' value=" & commentRS("phrase_id") & ">Delete</button></td>"
Response.Write "<td>" & commentRS("phrase") & "</td></tr>"
commentRS.MoveNext
Loop
CloseRecordset commentRS
I have a hidden input type on the page called deleteVal that needs to be equal to the value of the delete button clicked, so it can be passed to a stored procedure.
<input type="hidden" name="deleteVal" id="deleteVal" value=0/>
I've tried:
function changeDeleteVal(thisBtn)
{
var delVal = document.getElementById("deleteVal").value;
delVal = thisBtn.value;
}
and
$(function () {
$(".delete").click(function () {
$("#deleteVal").val() = this.value;
});
});
I Response.Write deleteVal and get "0/0/0"
The jquery attempt needs to be changed to work, from
$(function () {
$(".delete").click(function () {
$("#deleteVal").val() = this.value;
});
});
to
$(function () {
$(".delete").click(function () {
$("#deleteVal").val(this.value);
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.