Reputation: 43
I have this problem that when using single quotes in my javascript those single quotes will be changed to double quotes from the browser
var divs = $(".new_spezial > .contentContainer");
for(var i = 0; i < divs.length; i+=3) {
divs.slice(i, i+3).wrapAll("<div class='spezial_row'></div>");
}
even escaping the single quotes does not help.
var divs = $(".new_spezial > .contentContainer");
for(var i = 0; i < divs.length; i+=3) {
divs.slice(i, i+3).wrapAll("<div class=\'spezial_row\'></div>");
}
It will always be changed to this in the browser:
var divs = $(".new_spezial > .contentContainer");
for(var i = 0; i < divs.length; i+=3) {
divs.slice(i, i+3).wrapAll("<div class="spezial_row"></div>");
}
How would I fix this?
Upvotes: 0
Views: 166
Reputation: 43
I found the Problem it was that in my CMS (Typo3) I had
xhtml_cleaning = all
activated. Therefore the single quotes were replaced...
Upvotes: 1
Reputation: 1876
have you tried this 2 options?
var divs = $(".new_spezial > .contentContainer");
for(var i = 0; i < divs.length; i+=3) {
divs.slice(i, i+3).wrapAll('<div class="spezial_row"></div>');
}
var divs = $(".new_spezial > .contentContainer");
for(var i = 0; i < divs.length; i+=3) {
divs.slice(i, i+3).wrapAll("<div class=\"spezial_row\"></div>");
}
Upvotes: 0