Duplicate data attributes of input
See original GitHub issueI’m having problems with the component due to the hidden input created has the data-attributes of the original input copied. I mean, having:
<input type='text' id='x' name='x' data-role="x" class='form-control'/>
So I configure the typeahead for the object $(‘#x’). Once created I find:
<input type='text' id='x' name='x' data-role="x" class='form-control tt-input' />
<input type='text' data-role="x" class='form-control tt-hint'/>
The problem is that, after I use $(‘[data-role=x]’).val() and I expect only 1 result but I got 2 instead.
I would like that the created input for the component doesn’t copy the data- attributes as doesn’t copy name or id. Thanks a lot.
Issue Analytics
- State:
- Created 9 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Can an HTML element have the same attribute twice?
It's not technically valid, but every browser will ignore duplicate attributes in HTML documents and use the first value ( data-foo="bar" in ...
Read more >Using data attributes - Learn web development | MDN
To get a data attribute through the dataset object, get the property by the part of the attribute name after data- (note that...
Read more >Copy all the attributes of one element and apply them to ...
Select both elements(target and source element). · Get the properties of source element by using el.prop('attributes') method. · Use .each() ...
Read more >Prevent duplicate values input based on 1 entity attribute
Hi,. Is there anyway to prevent the input to an Entity from user if there is a duplicate in entry of an attribute...
Read more >Identifying duplicate attributes in field using QGIS
And of course you can enable a data derived override based on the the same. For example, if you want to highlight labels...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The biggest issue with this problem is React.js. Since React assigns
data-react-id
attributes to most elements (if not all), when the typeahead is initialized it creates 2 inputs with the samedata-react-id
and React goes bonkers.Perhaps we could have a setting with which turn on or off this behaviour?
I’m also getting Google Web Console crawler errors for duplicate itemprop=“query-input” field on site search box