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 } ?>
attr
. Check whatinputatr
contains. String concatenation works this way, but make sure you produce the right string. Please post your HTML. – Felix Kling May 6 '11 at 13:03