2021年1月22日星期五

HTML and Jquery Modal for Editing

I am somehow new to Jquery and is going through some code of a project.

The existing Jquery looks like this and this pops up a modal of confirmation upon delete:

  

I think this project uses jquery-confirm after searching for similarities in the code, I read about it here: https://craftpip.github.io/jquery-confirm/ it can also be found here: How to display a confirm box before submitting a form using jquery confirm?

So upon the click of a button in the html. e.g

  <button id="delete_">Delete</button>  

The jqeury will be triggered producing a confirmation. After confirmation the deleteprofile action which is from the views of the backend will be triggered and it will make the DELETE request.

However, I want to be able to make an edit modal from this.

Where an item from a list of items, such as profiles when clicked will produce a modal.

I searched for it and found these resources:

Bootstrap: Modal dialog for editing data dynamically Jquery .on() submit event

But all of them dont recieve the which will trigger the specific item. For example, I only want to edit, profile-001, but it cant be done with these samples. I already tried them and the modal didnt pop out.

I found this: How to make an "Edit User" form inside Bootstrap Modal using JQUERY?

But this is on PHP, I am using only jinja for this. I also couldnt replicate this on the html. as I am fairly new to frontend stuff.

How do you usually add input fields to modals in jinja, or in jqeury in this case? I want to be able to pop out a modal which will have input values, which will be recieved by jquery per item.

Any source to what i want to find is also welcome, I have been scanning four hours already and tried testing it but I cant get a modal to pop up except for the deletion modal.

https://stackoverflow.com/questions/65855042/html-and-jquery-modal-for-editing January 23, 2021 at 10:07AM

没有评论:

发表评论