Not sure where I'm goign wrong here, so I'm trying to use two string in javascript, but visual studio is showing the strings as error.
The code:
@{
string animCat = string.Format("#animCat{0}", counter);
string animCatClone = string.Format("#animCatClone{0}", counter);
}
<script type="text/javascript">
if (!jQuery(@animCat)[0].beginElement) {
jQuery(".home-category-container .image-wrapper.clone, .home-category-container .image-wrapper.orig").css({ "filter": "blur(25px)" });
}
jQuery(document).ready(function () {
setTimeout(function () {
if (jQuery(@animCat)[0].beginElement) {
jQuery(@animCat + ", " + @animCatClone)[0].beginElement();
}
else {
jQuery(".home-category-container .image-wrapper").css("filter", "blur(0px)");
}
jQuery(".home-category-container .image-wrapper.orig").css("visibility", "visible");
jQuery(".home-category-container .image-wrapper.clone").remove();
}, 1000);
});
</script>
Image showing what I mean:
Not sure what I'm missing.
Also when I hover over the red squiggle line it says "Predefined type 'System.String' is not defined or imported".
Have also tried if (jQuery('#animCat' + @counter)[0].beginElement) {} but this doesn't work #animCat' + 1 etc is output
Cheers

System, but it is usually automatically added inViews/Web.configfile. You have another problem - no quotes around generated JS selectors. As result, you will havejQuery(#animCat0)which is invalid JS. It should bejQuery("@animCat")and in every place where you useanimCatoranimCatClone.@using System;says the type or namespace 'system' could not be found(are you missing dada dadada) and Using directive is unnecessary