custom-data-attribute Questions

8

Solved

I have a div with an attribute data-myval = "10". I want to update its value; wouldn't it change if I use div.data('myval',20)? Do I need to use div.attr('data-myval','20') only? Am I getting conf...
Laurynlausanne asked 23/11, 2012 at 6:29

1

Solved

I'm trying to create an object that can be spread into a React Component and this object has to include an HTML Custom Data Attribute. import { HTMLAttributes } from 'react' interface FooProps ext...
Gracie asked 22/12, 2023 at 3:12

7

Solved

Is it possible to select elements in CSS by their HTML5 data attributes (for example, data-role)?
Think asked 16/3, 2011 at 11:7

5

I have a button which when clicked opens up a modal, and the content to show in the modal is based on the data-attributes passed to the button. My button, <button class="btn btn-info" ...
Fluoride asked 16/2, 2017 at 9:4

10

Solved

I plan on building a custom photo gallery for a friend and I know exactly how I am going to be producing the HTML, however I am running into a small issue with the CSS.(I would prefer to not have t...
Dibs asked 31/3, 2013 at 21:8

4

Solved

This seems like it should be trivial for JQuery to do, but this function is hiding the whole form... can someone point me in the right direction? $('form') .children() .filter(function(){ retur...
Meda asked 27/1, 2012 at 16:20

10

Solved

Let's assume you have the following HTML5 <select id="example"> <option value="AA" data-id="143">AA</option> <option value="BB" data-id="344">BB</option> </selec...
Audient asked 7/3, 2014 at 21:40

17

Solved

I'm using the jQuery Quicksand plugin. I need to get the data-id of the clicked item and pass it to a webservice. How do I get the data-id attribute? I'm using the .on() method to re-bind the click...
Hanford asked 15/3, 2011 at 9:44

11

Solved

I have next html: <span data-typeId="123" data-type="topic" data-points="-1" data-important="true" id="the-span"></span> Is it possibl...
Kiakiah asked 17/11, 2015 at 15:19

11

Solved

Given an arbitrary HTML element with zero or more data-* attributes, how can one retrieve a list of key-value pairs for the data. E.g. given this: <div id='prod' data-id='10' data-cat='toy' da...
Ysabel asked 15/11, 2010 at 17:19

3

Solved

How to get data attributes using jquery .data()? In which case html5 data-* attributes converts to lowercase and camelcase? What are all the main rules to follow while using custom attributes to st...
Pharmacology asked 31/3, 2014 at 4:24

12

Solved

Is there an easy and straight-forward method to select elements based on their data attribute? For example, select all anchors that has data attribute named customerID which has value of 22. I am...
Sutra asked 21/3, 2010 at 16:13

6

Solved

Is there anyway to have a SelectList prepopulated on ViewModel with data-attributes ? I want to do @Html.DropdownListFor(m=> m.CityId, Model.Cities); so it generates code like : <select...

5

Solved

I have a few elements like below: <a class="slide-link" href="#" data-slide="0">1</a> <a class="slide-link" href="#" data-slide="1">2</a> <a class="slide-link" href="#" ...
Wilcher asked 13/2, 2014 at 14:18

3

I wanna use jQuery's data() api to retrieve all the data attribute of an element. But the cache nature of this api is really annoying. Sometimes I need to change some data atribute of an element in...
Siffre asked 5/2, 2014 at 20:40

2

Solved

I have an input that I want to display a custom error message on when the user doesn't fill it out. <input type="text" class="foo" value="" data-prop="foo" data-rules="{ required: true }">&...
Masuria asked 21/5, 2013 at 23:58

4

Solved

I have a custom JS function that creates/inject a custom link into all elements in the page when it loads. Before manipulation: <div class="myimagediv"> <img class="img-tag" src="#" da...
Valiancy asked 11/9, 2017 at 14:55

5

Solved

My html syntax is as below <select id="category" name="category"> <option value="0">Please Select</option> <option value="50" data-value="akne">ACNE</option> <o...
Carapace asked 5/12, 2018 at 12:7

5

Solved

According to the dataset specification, how is element.dataset meant to delete data attributes? Consider: <p id="example" data-a="string a" data-b="string b">&lt...
Dinsdale asked 8/2, 2012 at 20:15

3

Solved

Inside my view i have a button as follow: <button data-assigned-id="@IdUser" onclick="updateClick()" type="button" class="btn btn-sm btn-default"></button> My div <div id="partia...
Marandamarasca asked 6/4, 2016 at 12:29

3

Solved

I want to use annotations for setting the default value for my properties in Entity Framework Core. The issue is that the database is not setting the default values so the value is not being passed...
Footstep asked 6/3, 2019 at 23:12

3

Solved

I can have %a{href: '#', data_toggle_description_length: 'toggle_me_ajax'} which it gives me underscores not dashes, i.e. <a href="#" data_toggle_description_length="toggle_me_aj...

6

Solved

I think I'm using removeData correctly but it doesn't seem to be working, here's what I'm seeing in the dev console, could anyone explain what I'm doing wrong? I'm outputting the current data attr...
Bloc asked 17/5, 2013 at 18:9

6

Solved

I use some custom attributes in my html, for jquery stuff. I saw there are data-XYZ attributes in HTML5, but I need to be xhtml 1.0 strict. What other options do I have?
Lavish asked 15/11, 2010 at 21:36

4

Solved

So I have a React component with a button which has a click handler which uses the data-* attribute. If this was straight React then I know how to get the value from the data-* attribute. However I...

© 2022 - 2024 — McMap. All rights reserved.