Solved

jquery get button through value

Posted on 2013-01-09
5
245 Views
Last Modified: 2013-01-10
Hi,

I've been searching on how to find a button (button tags) using only it's value.

$('input[value="'+getAlignment(node)+'"]').addClass("active");

Open in new window


This code doesn't seem to work (getAlignment function is correct as I checked it thourgh debugger). Doesn't input recognize button tags?
0
Comment
Question by:Mutsop
[X]
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
  • 2
  • 2
5 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 38761450
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 38761469
Doesn't input recognize button tags?
Is it an input, or is it a button? There are two ways to create a button in HTML (well, technically 3 if you count a submit button):

<input type="button"></input>
<button></button>

Open in new window


So which are you using? A JQuery of $('input') will not find a <button> tag.
0
 
LVL 3

Author Comment

by:Mutsop
ID: 38762238
it's a <button> I need to have.
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 38762684
Then swap "input" for "button" in your JQuery.
0
 
LVL 3

Author Closing Comment

by:Mutsop
ID: 38765390
wasn't expecting it to be that easy -.- Thanks! :D
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
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…

752 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