javascript - Add class or style if text in div appears -


i have order form i'm making. right when put coupon code want apply div of old price style or class (line-through) , though had right...here i'm doing.....any suggestion why might not working? warning: new javascript....i've been working css html javascript story. thanks!

if ($('#grand_amount_value').length > 1){     $("#total_amount_old_val").attr("style", "text-decoration:line-through"); } 

here example threw show working:

https://jsfiddle.net/pj6xwhcy/3/

function strikeoldamt() {     var gav = $("#grand_amount_value");     if (gav.length > 0 && gav.text() != "" ){         // there gav element , not empty, strike out old amount!         $("#total_amount_old_val").css("text-decoration", "line-through");     } } 

note: using "style" attribute wipe out other custom styling may have added. using css() function not interfere if style attribute set.


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -