• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

jquery get button through value

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
Mutsop
Asked:
Mutsop
  • 2
  • 2
1 Solution
 
leakim971PluritechnicianCommented:
0
 
käµfm³d 👽Commented:
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
 
MutsopAuthor Commented:
it's a <button> I need to have.
0
 
käµfm³d 👽Commented:
Then swap "input" for "button" in your JQuery.
0
 
MutsopAuthor Commented:
wasn't expecting it to be that easy -.- Thanks! :D
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.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now