Communities for your favorite technologies. Explore all Collectives
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I want to add an attr data-columns into <div id="grid">
data-columns
<div id="grid">
Like this : <div id="grid" data-columns>
<div id="grid" data-columns>
I try it but it does not work : $('#portfolio').attr("data-columns");
$('#portfolio').attr("data-columns");
Thanks for your help !
If you want to set an attribute, you need to give it a value:
$('#portfolio').attr("data-columns", "yourvalue");
http://api.jquery.com/attr/
Add a comment
First you have to give some values to data-columns
<div id="grid" data-columns="some Value">
Then access it like
var x = $('#grid').attr("data-columns")
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.