<p>while exploring jQuery I came up with the following weird script. I don't see myself doing this really however concatenating strings to achieve a variable name is not unusual in JavaScript. </p>

<p>Any feedback welcome.</p>

<pre><code>...
    &lt;script type="text/javascript"&gt;
        var a = 'y';
        $(document).ready(function() {
            $('p[id^=' + $('p[id=x]').html() + a + "]").css('color','blue');
        });
    &lt;/script&gt;
...

&lt;p id="x"&gt;2a&lt;/p&gt;
&lt;p id="2ay_"&gt;mytext&lt;/p&gt;
</code></pre>

Short answer is no, there aren't side-effects.  Your example is quirky, but as you said you were just exploring to see what you could do.  I have used string concatenation and function value returns inside jQuery selectors before, it can be a useful technique for managing sets of related elements which reside in different parts of the DOM.
I admit I haven't used
```
jQuery.html()
```
inside a selector, but there isn't any inherent reason why that's "bad".  I just can't think of a situation where that'd be strictly necessary.  It does make the code rather... unusual, and hence more difficult to understand and maintain.
If you actually find a use for this in production code, please let us know.  I'd be fascinated to see what it is. :)