I want to add an attr data-columns
into <div id="grid">
Like this : <div id="grid" data-columns>
I try it but it does not work : $('#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");
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")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.