Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use attr to set disabled attribute for a tag, instead of using prop #328

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pzgz
Copy link

@pzgz pzgz commented Jun 11, 2013

Since anchor tag a doesn't actually support disabled attribute. So,
if we use prop to disable a link, the css selector a[disabled]
won't work. In some css frameworks, such as bootstrap, the anchor won't
have any differences. Using attr() will make things different.

Since anchor tag `a` doesn't actually support `disabled` attribute. So,
if we use `prop` to disable a link, the css selector `a[disabled]`
won't work. In some css frameworks, such as bootstrap, the anchor won't
have any differences. Using attr() will make things different.
@pzgz
Copy link
Author

pzgz commented Jun 11, 2013

For this change, it's mainly because, we used both link anchors and buttons in a form to do things, and we would like to block the buttons during the server processing.

Currently, the buttons with data-disable-with set will be blocked (has a disabled state) and will have the wording changed. But, for the link anchors, nothing will be changed, I do understand `prop('disabled', true) will be applied to the links, but the problem is:

  • The link text won't changed with data-disable-with setting
  • disabled property actually not supported by link anchor, therefor, if you used a CSS selector such as a[disabled]. The styles won't be applied. We are using bootstrap.

So the simple idea is, for link anchors, we can still use `.attr('disabled', true) to disable the link anchor, the css selectors will work too.

I understood there are some other things might need to be considered, such as, if we click on the link anchors, only the link clicked will be blocked, the buttons in same form will stay original. Not like if we click on the buttons. I am still thinking what's the best approach to links and buttons in a form, but at least we can have a start. Any suggestions?

@barmstrong
Copy link

+1 ran into this same issue

I'm pretty sure this is affecting a lot of people. Anyone doing rails + bootstrap is going to see this issue with data-disable-with.

@crhan
Copy link

crhan commented May 7, 2014

👍 the same issue.

@JangoSteve
Copy link
Member

Interesting. Pretty simple fix. Can anyone come up with a test case for this? If not, we can, it'll just take longer to pull this in.

@troytc
Copy link

troytc commented Oct 22, 2014

Any updates on this issue? Ran into this recently in a RoR + BS3 project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants