Skip to content

Commit

Permalink
Optional input value
Browse files Browse the repository at this point in the history
  • Loading branch information
tib committed Dec 18, 2021
1 parent 85813b7 commit ebf9092
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/SwiftHtml/Html/Tags/Input.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,10 @@ public extension Input {
}

/// Specifies the value of an `<input>` element
func value(_ value: String) -> Self {
node.upsert(Attribute(key: "value", value: value))
func value(_ value: String?) -> Self {
if let value = value {
node.upsert(Attribute(key: "value", value: value))
}
return self
}

Expand Down

0 comments on commit ebf9092

Please sign in to comment.