i using http referer string of text , match alt text of image if matches, class image removed. problem having not work plurals e.g if string e.g cards , alt text id card, class not removed, whereas should. below code im using:
jquery:
$('div.bcbox img').attr('alt', function(index, value){ return value.tolowercase(); }); $("div.bcbox img[alt*='<?php echo str_replace('+', ' ', strtolower($whatiwant)) ?>']").removeclass("bccustom");
php:
session_start(); if ( !isset( $_session["origurl"] ) ){ $_session["origurl"] = $_server["http_referer"]; } $mysearchterm = $_server["http_referer"]; $whatiwant = substr($mysearchterm, strpos($mysearchterm, "=") +1); $whatiwant = str_replace('+', ' ', strtolower($whatiwant)); $querystr = $_server["http_referer"];
here link fiddle working example: when alt text in singular, jquery img[alt*='menus']
stops working image singular alt text
i think want this:
var word = "menu" $("div.bcbox img").each(function() { if (this.alt.tolowercase().indexof(word) !=-1) { $(this).removeclass("bccustom"); } });
old version:
$('div.bcbox img').attr('alt', function(index, value){ var val = value.tolowercase(); return (val.charat(val.length-1)=="s")?val.slice(0,-1): val; });
now menu remove menus , menu
$("div.bcbox img[alt*='menu']").removeclass("bccustom");
Comments
Post a Comment