Display Bootstrap Modal using javascript onClick

后端 未结 4 1510
时光取名叫无心
时光取名叫无心 2021-02-03 20:48

I need to be able to open a Twitter bootstrap modal window using the onClick=\"\" or similar function. Just need the code to go into the onClick=\"\".

4条回答
  •  借酒劲吻你
    2021-02-03 21:33

    I was looking for the onClick option to set the title and body of the modal based on the item in a list. T145's answer helped a lot, so I wanted to share how I used it.

    Make sure the tag containing the JavaScript function is of type text/javascript to avoid conflicts:

    
    

    This function can now be called in the onClick method from inside an element such as a button:

    
    

提交回复
热议问题