javascript - Escape double quotes -
javascript - Escape double quotes -
my json:
{ "label": "menu position", "name": "topmenualign", "type": "select", "values":["left", "right", "center"], "default": "right" },
my js:
var ipdesignoptions = { 'topmenualign': function (value){ $('nav ul.level1>li').css('text-align', value); } };
generated style:
text-align:**"value"**;
should be:
text-align:**value**;
how escape double quotes? i've tried few ways described in stack overflow no luck.
update:
this impress pages theme cms
i using 1 of examples build options theme design.
there 4 files need play with.
config.less --> define specific variable e.g. @topmenualign: right;
style.less --> define info result e.g. nav {text-align:@topmenualign;}
theme.json --> specify options
e.g. {
"label": "menu position", "name": "topmenualign", "type": "select", "values":["left", "right", "center"], "default": "right" }
options.js ...
var ipdesignoptions = {
'topmenualign': function (value){ $('nav').css('text-align', value); } };
this combination allows theme user adjust design visually , updates main css file "theme.css" value
nav {text-align:"value";}
everything straight forwards , works perfect numeric value e.g. padding:'@value'px, words come out double quotes , don't understand , how should escape them.
i check if can post on fiddle later, don't think able implement working illustration - need database think. p.s. reference https://github.com/algimantas/theme-lessskeleton/
i not want modify core files , come solution within theme files if @ possible. how pass php? suppose write specific css within php page using php variables.
please not edit "impresspages" tag, might attracts people familiar system.
javascript json double quotes impresspages
Comments
Post a Comment