t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

How to set dynamic value in input field #867

Closed rahul7p closed 5 years ago

rahul7p commented 6 years ago

@t4t5 I want to set dynamic value in input field when sweet alert open. inputValue : text_val

here text_val is dynamic value And when I set dynamic value then it's showing me undefine.

t4t5 commented 5 years ago

You can do it like this:

swal("Write something here:", {
  content: {
    element: "input",
    attributes: {
      value: "Hello"
    }
  }
})