Jump to content

cssQuery


tobeyt23

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.