0

I am not sure how to select the input below using Javascript selectors. I tried this but that doesn't seem to be correct:

$("input:text[name=[11235]");
<div class="Row-LineDetail A" id="Row1235">
<span class="Col-Label LineIndent1">
</span>
<span class="Col-Dollar">

<input type="text" name="l1235" value="$5,000.00" cols="8"   onkeyup="validateNegAmount(this);" onblur="transform(this)" onfocus="removeFormatters(this);this.select();">

</span>
</div>
2
  • its jquery selector, you have to add jquery api to your page Commented Dec 20, 2013 at 20:33
  • FYI I am using JQuery and JQuery API is imported to my page. FYI this is my first time posting to Stack Overflow, and the speed of responses here is incredible! Thanks for the info! Josh Portland, OR Commented Dec 20, 2013 at 20:35

5 Answers 5

1
$('input[name="l1235"]')

That would work if you are using jQuery, as in your example above.

Sign up to request clarification or add additional context in comments.

1 Comment

If you are NOT using jQuery, the answer is going to be a bit different.
0

You'll want something like this:

$("input[name='11235']");

Take a look at http://api.jquery.com/category/selectors/attribute-selectors/ for more information about attribute selectors.

1 Comment

The letter 'l' in the name was also throwing me off! I thought it was the number '1'.
0

Since you appear to be using jQuery the following would work:

   $("input[name='l1235']")

Comments

0

with using jquery $('input[name="l1235"]')

with pure javascript document.getElementsByName('l1235')

Comments

0

For you

Simply use

$('input[name=l1235]');

Other method

If you want to select the text elements, then you can ues

$('input[type=text]');

Other queries can be executed after this such as:

if($(this).attr('name') == 'l1235') { 

And so on! :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.