Welcome, Guest
Username: Password: Remember me

TOPIC: Accesing forms in V 2.0 with jQuery

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

  • madaura
  • madaura's Avatar
  • Offline
  • Junior Member
  • Posts: 35
  • Thank you received: 3
  • Karma: 0
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!
Last Edit: 03 Oct 2012 13:45 by admin.
The administrator has disabled public write access.

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

  • JoomGuy
  • JoomGuy's Avatar
  • Offline
  • Moderator
  • Joomla Enthusiast, Lover of Cooking
  • Posts: 1115
  • Thank you received: 195
  • Karma: 64
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!!!
Last Edit: 18 Dec 2012 22:02 by JoomGuy.
The administrator has disabled public write access.
Time to create page: 0.152 seconds

Get Started