set data attribute with a string jquery code example
Example: set data attribute with a string jquery
alert($('#outer').html()); // alerts
var a = $('#mydiv').data('myval'); //getter
$('#mydiv').attr("data-myval","20"); //setter
alert($('#outer').html()); //alerts