Solved

JQuery Get/Find form button using text value

Posted on 2013-01-17
1
311 Views
Last Modified: 2013-01-17
Hello,

If I have the following button in my page

<input type="button" class="btn" value="Find"  />

This button is loaded from a 3rd party application and does not have an id.
If it did have an id (e.g. "testb") I could use something like the following to find my button and set it's background image

$('[id$="testb"]').css("background-image", "url(http:www.mytest.com/myTest.jpg)");

However my button will never have an id and there is also the possibility that more than one button on the page therefore I can't search by class or type.

Can I search using the value"Find" as this will be unique?

Thanks in advance.
0
Comment
Question by:speedygonzalez
1 Comment
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38787058
Try this :
$(':button[value="Find"]').css("background-color", "red");
0

Featured Post

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.

Question has a verified solution.

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

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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)
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…

823 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