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()"; } Link to comment https://forums.phpfreaks.com/topic/112594-cssquery/ 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; } Link to comment https://forums.phpfreaks.com/topic/112594-cssquery/#findComment-578557 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.