jquery - What's the difference between [attribute~=value] and [attribute*=value]? -


What is the difference between these two jQuery selectors?

These definitions are from w3schools.com:

  • [attribute ~ = value] selector with each specific attribute Chooses a value that has a specific string value.

  • [attribute * = value] selector selects each element with a specific attribute, which contains a string value.

    Update:

    Here are the definitions from jquery.com. This answers my question:

    • [attribute ~ = value] - A word is given by selecting elements with the specified element, in which the space - Selects the elements that have the specified attribution that are given a given substring value is.

      * = Select the attribute selector , from:

      Selects the elements that have the given attribution given the value of the substrings given.

      ~ = is attributeContainsWord selector , from:

      Selects the elements that have the specified attribution, in which there is a word that is delimited by an empty space.

      and

      The attribute content selector for the string that is attributed to the attribution is the Ute value while the attribute ContentWind selector is for a different string with a delimited location. Official jquery examples clearly explain it.

      Explanation: Selector in the attribute [name * = "value"]

      HTML:

        & lt; Input name = "man-news" & gt; & Lt; Input name = "milkman" & gt; & Lt; Input name = "letterman2" & gt; & Lt; Input name = "newmilk" & gt;   

      JQUERY:

        $ ("input [name * = 'man']") .val ("man in this!" );   

      Output:

      The

      Demo example:

      ]

      HTML:

      JQUERY: $ ("input [name ~ = 'man']") .val ("mr. Man is in it! ");

      Output:

      Enter image details here

      Demo example:



Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -