Opened 12 years ago

Closed 10 years ago

#7573 closed feature (notabug)

Button should support enhancing submit button input with icons

Reported by: [email protected] Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.button Version: 1.8.14
Keywords: Cc:
Blocked by: Blocking:

Description

The documentation for the button widget says: "When using an input of type button, submit or reset, support is limited to plain text labels with no icons."

I see no good reason for this. I have a hack to make it work, but this should really be rolled into the button widget. here is the code I have to make it work:

function createInputButton(inputButton, buttonOptions) {

var $facade = $("<a id='" + $(inputButton).attr('id') + "-facade'></a>").html($(inputButton).val()).button(buttonOptions).click(function () {

$(inputButton).click();

}); $(inputButton).hide().after($facade);

}

usage:

createInputButton($("#Search"), { icons: { primary: "ui-icon-search"} });

This creates a new anchor tag and turns it into a button with the desired options, puts it after the original input, hides the original input, and passes the click event of the anchor tag to the button (to submit the form).

Please consider including this in the next release.

Change History (4)

comment:1 Changed 12 years ago by Scott González

We might completely change the approach for buttons to always create a proxy element, which would solve this.

comment:2 Changed 11 years ago by Scott González

Type: enhancementfeature

comment:3 Changed 10 years ago by Scott González

Milestone: 1.9.01.11.0

comment:4 Changed 10 years ago by bchiasson

Resolution: invalid
Status: newclosed

The HTML specification does not permit nested content for input elements and the ui icons are applied via nested content.

http://www.w3.org/TR/html-markup/input.button.html http://www.w3.org/TR/html-markup/input.submit.html http://dev.w3.org/html5/spec/single-page.html#the-input-element

Note: See TracTickets for help on using tickets.