code_junkie

Are there side effects to using string concatenation or jQuery inside jquery selectors?

Nov 12th, 2011
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. ...
  2. <script type="text/javascript">
  3. var a = 'y';
  4. $(document).ready(function() {
  5. $('p[id^=' + $('p[id=x]').html() + a + "]").css('color','blue');
  6. });
  7. </script>
  8. ...
  9.  
  10. <p id="x">2a</p>
  11. <p id="2ay_">mytext</p>
Add Comment
Please, Sign In to add comment