jQuery Get Textbox ID From Loop Choosed
Clash Royale CLAN TAG#URR8PPP
jQuery Get Textbox ID From Loop Choosed
I have multiple textbox from loop.
$qComposition = oci_parse($c1, "SELECT * FROM WA_SAC_TBL_COMPOSITION WHERE ACTIVE = 'Y' AND COMPOSITIONID != 'CM0001' ORDER BY LIST_ORDER ASC");
oci_execute($qComposition);
while($dComposition = oci_fetch_array($qComposition))
?>
<input type="text" class="inputText input<?php echo $dComposition['COMPOSITIONID']; ?>" placeholder="<?php echo $dComposition['COMPOSITION_NAME']; ?>" id="<?php echo $dComposition['COMPOSITIONID']; ?>" onkeypress="javascript:this.value=this.value.toUpperCase();" onkeyup="javascript:this.value=this.value.toUpperCase();" style="display: none;" disabled/>
<?php
Table WA_SAC_TBL_COMPOSITION
:
WA_SAC_TBL_COMPOSITION
COMPOSITIONID | COMPOSITION_NAME
CM0001 | Status Sheet
CM0002 | Accessories Sheet
CM0003 | Box P/N
CM0004 | Pack Label P/N
CM0005 | Name Label
CM0006 | Warranty Card
CM0007 | DVD Part No
CM0008 | AC Code
And the result display on HTML to be
Then I have selected specific COMPOSITIONID
to be show. Table WA_SAC_TBL_PRODUCT_COMPOSITION
, here is the data:
COMPOSITIONID
WA_SAC_TBL_PRODUCT_COMPOSITION
COMPOSITIONID_FK PARTID_FK
CM0003 PA0001
CM0009 PA0001
CM0006 PA0001
CM0004 PA0001
CM0005 PA0001
CM0001 PA0001
As you can see CM0002
is not registered on table.
CM0002
Here is JS to get selected COMPOSITIONID
COMPOSITIONID
$('.listScan, .inputText').hide(); //To hide all textbox
var lenComposition = jsonStr.composition.length;
for(var i=0; i<lenComposition; i++)
var composition = jsonStr.composition[i];
$('#'+composition).show(); //To show only choosed textbox
$('.input'+composition).attr('disabled', true);
var getTextboxID = $('input.inputText:eq(0)').attr('id');
alert(getTextboxID);
When I try to alert(getTextboxID)
, it show me CM0002
. As We know I didn't register it on choosed table. I know the JS get CM0002
from $qComposition
above.
alert(getTextboxID)
CM0002
CM0002
$qComposition
But now I want JS get the ID only from choosed.
How to achieve that?
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.