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.074 seconds
  I still don't believe he can really be human to do all this ! From all of the forums that I've ever participated in this is certainly the one that most encapsulates the feeling of being truly open source where everyone's opinions and contributions can and will shape the development of the service! It's truly awesome! Hope you enjoy cooking and look forward to reading and contributing to any of the editorial work that you proposed too!! Thanks
Gez (audibleid - JED)

Get Started