This is a revolution slider button.
I would like to get the "rs-26"
from the data-actions
attribute of a div
. How can I get it using jQuery?
data-actions="[{"event":"click","action":"jumptoslide","slide":"rs-26","delay":""}]"
This is a revolution slider button.
I would like to get the "rs-26"
from the data-actions
attribute of a div
. How can I get it using jQuery?
data-actions="[{"event":"click","action":"jumptoslide","slide":"rs-26","delay":""}]"
There are a few ways you can do this. Without knowing that your action div looks like, I assumed it was something like this:
<div id="theDiv" data-actions='[{"event":"click","action":"jumptoslide","slide":"rs-26","delay":""}]'>
div with content
</div>
Then, the jQuery you would want could be something like this:
$(document).ready(function() {
var actions = $("#theDiv").data("actions");
var theSlide = actions[0].slide;
console.log('The Slide: ' + theSlide);
});
I just used $(document).ready(function() {
so that it would happen upon page load, but you can use that where you need it.
Here are a few additional resources that might help:
How to access JSON Object name/value?