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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses

738 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