+ Start a Discussion
Karthik TathiReddyKarthik TathiReddy 

Onclick remove() function is not working for span tag in chrome and IE

HI,

I wrote onclick function for a span tag as below

<div class="property_in"><img src="'+hurl+'" width="210" height="138" /><div class="property_title">'+val1+'<br /><span class="property_remove"><p onclick="remove(\''+ivid+'\');" style="cursor: pointer;">Remove</p></span></div></div>

 

Onclick the image should remove from the page. But the above one is not working for Chrome and IE browsers. Please give some idea how to work this on chrome and IE as well...

bob_buzzardbob_buzzard

Is the remove function one that you have written?  What is ivid?  Do you see any errors in the javascript console?

 

I think you'll need to post some more code if you want help - right now it could be anything.

Karthik TathiReddyKarthik TathiReddy

Failed to load resource: the server responded with a status of 403 (Forbidden) is the error i am receiving from the javascript console when i click on remove.

The following is the code how am I calling visualforce...

<apex:outputtext value="{!leadId}" escape="false" id="property"/>

Below is the code am calling from controller

 

if(qp!=''&&qp!=null) //qp is the parameter
                {
                string[] splitted = qp.split(',');
                
                Set<String> uniquev= new Set<String>();
                for(String s:splitted)
                {
                uniquev.add(s);
                }
                splitted.clear();
                splitted.addAll(uniquev);
                system.debug(uniquev);
                
                Integer qp1 = splitted.size();
                Integer i=0;                   
                //for(Integer i=0;i<qp1;i++)
                while(i<qp1)
                {
                String ivid = splitted[i];
                               
                DB__c l = [SELECT Id,Location_Title__c,Hero_Picture__c, Name FROM DB__c WHERE Id=:ivid LIMIT 1];
                DBIds.add(l.Id);
                String[] spltDB = l.Name.split('-');
                String hurl = l.Hero_Picture__c;
                if(hurl==null)
                {
                hurl='http://google.com/images/noimg.jpg';
                }
                //intrestedD+='<a href="https://ap1.salesforce.com/'+ivid+'">'+l.Location_Title__c+'</a><br>';            
                intrestedD+=l.Name+',';
                String val1 = l.Location_Title__c +' ['+spltDB[1]+']';
                
                //iurl = '/images/img_e.gif';
                leadId +='<div class="property_in"><img src="'+hurl+'" width="210" height="138" /><div class="property_title">'+val1+'<br /><span class="property_remove"><p onclick="remove(\''+ivid+'\');" style="cursor: pointer;">Remove</p></span></div></div>';
               
                i++;
               
                }
                }

 

Avidev9Avidev9
Where is the remove method ?
I couldn't see one.
Vinita_SFDCVinita_SFDC

Hello,

 

The syntax seems fine in Chrome as it is in any other browser. The problem is most likely in the remove function. Please check if you get any error in chrome (Press Ctrl+Shift+J to open the console) and try with following code to verify if the issue is with remove function

<a href="#" onClick="alert('flag')">Flag Link</a>

<span class="property_remove"><p onclick=""alert('flag')">Test Flag</p></span>

Likewise you can test in IE as well using developer tool.