joshgoldeneagle
joshgoldeneagle

Reputation: 4646

How would I select this input using Javascript selectors?

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>

Upvotes: 0

Views: 81

Answers (5)

Afzaal Ahmad Zeeshan
Afzaal Ahmad Zeeshan

Reputation: 15860

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! :)

Upvotes: 0

denolk
denolk

Reputation: 770

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

with pure javascript document.getElementsByName('l1235')

Upvotes: 0

ryanbrill
ryanbrill

Reputation: 2011

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.

Upvotes: 0

Kevin Bowersox
Kevin Bowersox

Reputation: 94429

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

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

Upvotes: 0

Charlie74
Charlie74

Reputation: 2903

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

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

Upvotes: 1

Related Questions