search for src filename using jQuery

Hi,

I have this bit of code and I need to dynamically change some CSS on a paypal button. How do I search for the source filename in this part:

<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_installment_plan_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">

Open in new window


So I'm looking for the input type='image' where src='https://www.paypalobjects.com/en_US/i/btn/btn_installment_plan_LG.gif'

Thank you!
Victor KimuraSEO, Web DeveloperAsked:
Who is Participating?
 
GaryConnect With a Mentor Commented:
If all you want to do is remove the border on the paypal button then just use

$("input[src='https://www.paypalobjects.com/en_US/i/btn/btn_installment_plan_LG.gif']").css({"border": "0"});
0
 
GaryCommented:
This would get the object, what you do with it then is upto you
$("input[src='https://www.paypalobjects.com/en_US/i/btn/btn_installment_plan_LG.gif']")
0
 
Victor KimuraSEO, Web DeveloperAuthor Commented:
I tried this:

var inputTypes = [];

                $('p#encypted_ppbtn input').each(function(){

                    var sCurSrcVal= $(this).attr(src);

                    if ( sCurSrcVal == "https://www.paypalobjects.com/en_US/i/btn/btn_installment_plan_LG.gif" ) {

                        $(this).css({"border": "0"});

                    }
                    inputTypes.push($(this).attr('type'));

                });

Open in new window


But it's failing at:
 var sCurSrcVal= $(this).attr(src);

How come?
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
GaryCommented:
Think you missed my comment above. Here's an example to change the src
http://jsfiddle.net/GaryC123/6v5uS/1/
0
 
Victor KimuraSEO, Web DeveloperAuthor Commented:
Oh, I forgot the quotes:

var sCurSrcVal= $(this).attr('src');

=)
0
 
Victor KimuraSEO, Web DeveloperAuthor Commented:
oh, that's much easier. Thanks, Cathal! =)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.