How do I concatenate a string with a javascript variable inside a jquery selector? If I execute the code below. All the other form elements gets hidden.
var inputatr = $('input[type=text]').attr(); //button
$('input[value=string ' + inputatr +']').hide(); //textbox
Update
<?php for($x=0; $x<4; $x++){ ?>
<input type="text" id="<?php echo $x; ?>" name="<?php echo $x; ?>" value="text<?php echo $x; ?>"/>
<input type="button" name="show<?php echo $x; ?>" value="string<?php echo $x; ?>"/></li>
<?php } ?>
$('input[value="string' + inputatr +'"]').hide();
This hides the input with the value equal to inputatr
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With