tobeyt23 Posted June 30, 2008 Share Posted June 30, 2008 I am trying to set all my text form inputs with onclicks using cssQuery. What am I doing wrong as it is found all 227 input text fields? var textInput = cssQuery('input[type|=text]'); for (var i=0;i<textInput.length;i++) { textInput[i].onclick = "this.select()"; } Quote Link to comment Share on other sites More sharing options...
KevinM1 Posted June 30, 2008 Share Posted June 30, 2008 I am trying to set all my text form inputs with onclicks using cssQuery. What am I doing wrong as it is found all 227 input text fields? var textInput = cssQuery('input[type|=text]'); for (var i=0;i<textInput.length;i++) { textInput[i].onclick = "this.select()"; } It looks like you have a syntax error. Specifically, you're trying to assign a string ("this.select()") to an event, which is illogical. Select() is the name of the callback function you're trying to attach, right? If so, try: for(var i = 0; i < textInput.length; i++) { textInput[i].onclick = select; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.