Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

Accesing forms in V 2.0 with jQuery 11 Sep 2012 01:59 #3508

  • madaura
  • madaura's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Posts: 35
  • Thank you received: 3
I don't understand why I can't access the below input text field using the next code of jQuery, in this case for example to change its "class" attribute: (through the "id" attribute?):

jQuery("#jform_nombres").attr("class", "inputbox ");

<input type="text" id="jform_nombres" name="jform[nombres]" class="inputbox validate[required,custom[stringaz]]" value="" size="32"/>

I'm stuck with this, thanks for any help!

Please Log in or Create an account to join the conversation.

Last edit: by admin.

Re: Accesing forms in V 2.0 with jQuery 18 Dec 2012 22:00 #6178

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
To which file are you adding this?
Where is it loaded - onbody or head?
Does your script initialise on document.ready?
Do you have any JS alerts?
Do you have jQuery loaded?

If jQuery is loaded, try setting a local var in your script
var targetInpur = $('input[id=jform_nombres]');
//alert the attribute
alert(targetInput);

If you get the result you're expecting then try using the prop() method in the same way you use attr().

Hope it helps!

Gez
Need help with your Cook/Joomla Project? . PM me to find out what I can help with. NO time wasters please!!!

Please Log in or Create an account to join the conversation.

Last edit: by JoomGuy.
  • Page:
  • 1
Time to create page: 0.057 seconds

First of all... I have to congratulate you guys for the awesome tool... I came here only to see what this thing was up to and I have to tell that I'm very impressed with what this tool can do. French guys are making a revolution on Joomla... first with Seblod and now Cook...
Griiettner (forum)

Get Started