Page 2 of 2

Change the css class with the mapping result

Posted: Thu Sep 17, 2015 2:10 pm
by Leonardo Valentin Zeferino

Ok, Sergiy!

I got it! Very simple solution.

I moved the javascript code to on_success mapping code instead of use it in html code.

code
"source": "$['body'][0]['_id']",
"target_transformation": function(value) {
if (value == "55600a7fe4b0f840f328ab8f") {
$( '#product_wishlist_bt' ).removeClass( 'product-bookmark' );
$( '#product_wishlist_bt' ).addClass( 'product-bookmarked' );
console.log("bookmarked");
}
},
"target": "$['wishlist_status:text']"
/code