tommydevs
tommydevs

Reputation: 147

FORM Submit button with text-decoration:underline via JS?

Since it doesn't appear to be possible to apply text-decoration: underline; to a form.submit button I'm wondering if someone can quickly show me how to apply it via JS? I only know html/css/php. Onmouseover=?

<span onmouseover="what goes here"><input type="submit"></input></span>

Thanks!

Upvotes: 0

Views: 204

Answers (2)

RobG
RobG

Reputation: 147363

Consider using a button instead:

.hoverUnderline:hover {
  text-decoration: underline
}

<button type="submit" class="hoverUnderline">Submit stuff</button>

Buttons in forms are submit buttons by default so don't actually need type="submit".

Upvotes: 0

IronFlare
IronFlare

Reputation: 2322

Your code seems to suggest that you want to underline the button itself. If you're trying to underline a button, I suggest applying the effect to the text of the button using CSS like so:

input[type=submit]:hover {
    text-decoration:underline;
}

DEMO

Upvotes: 2

Related Questions