Wednesday, 15 May 2013

jquery - How do you use :focus if you're also setting properties with Javascript? -


If you use a & lt; Input & gt; Styling is the element with javascript, it appears that any attributes you set in this way do not ignore the focus rule.

I have this that shows:

  • Initially the boundary of the background and input element is determined equal to the surrounding element (div.header)
  • Clicking on the [unlocked] link opens the div.body element, which was not initially shown.
  • I want to make it clear that the title is a text field, so change the background and threshold of the input to match the texture that was just detected.

    I have one: Focus rule for both texture and input, to paint the background background, it is clear that the text field is focusing.

    But it does not work on input elements, it appears because I set the program to those properties if I do not set them: Focus works as expected: Focus Right Properties Sets that are not set in .css () , they are respected.

    This is true on Safari, Firefox, Chrome and IE, obviously there is "expected behavior", but I think it's right that why nothing can be found online. (Why) That's right.

    Obviously I can implement whatever I want, but I am trying to understand why this is the method.

    Its specificity and especially

    are four components of the specificity ; Let's call them A, B, C and D. Component "A" is the most discriminated, one ???? ??? at least.

    • The component "A" is quite simple: 1 is for a declaration in a style attribute, otherwise it is S-0.

      Since .css updates the style attribute directly, it is highly specific than anything in your stylesheet You can use either Important to Importance (which is a priority over specificity), but a better option classes ( .addClass ) Instead of changing the style attribute instead.

No comments:

Post a Comment