search for src filename using jQuery

Posted on 2014-01-30
Last Modified: 2016-03-24

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="" 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=''

Thank you!
Question by:Victor Kimura
  • 3
  • 3
LVL 58

Expert Comment

ID: 39821373
This would get the object, what you do with it then is upto you

Author Comment

by:Victor Kimura
ID: 39821374
I tried this:

var inputTypes = [];

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

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

                    if ( sCurSrcVal == "" ) {

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



Open in new window

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

How come?
LVL 58

Expert Comment

ID: 39821380
Think you missed my comment above. Here's an example to change the src
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.


Author Comment

by:Victor Kimura
ID: 39821388
Oh, I forgot the quotes:

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

LVL 58

Accepted Solution

Gary earned 500 total points
ID: 39821398
If all you want to do is remove the border on the paypal button then just use

$("input[src='']").css({"border": "0"});

Author Comment

by:Victor Kimura
ID: 39821635
oh, that's much easier. Thanks, Cathal! =)

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
age from date of birth 4 43
Get Pixel color of the x and y axis Html without canvas 8 39
If condition on Html with Asp 11 18
tiny glitch in my main slider 3 24
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API ( has made its way into the popular lexicon of the English language.  A few years ago, …
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question