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.115 seconds

  I found "cook" two days ago. Played around with it for a day and then within a day got rid of two legacy applications in IBM Lotus Domino Notes and replaced them with "cook". It was really easy. A piece of cake. Actually it was even easier than cooking. Cooking involves more work than developing with "cook". What can I say about "cook"? Great application great price for what it delivers great forum with a lot of information and fast responses active and friendly community fast forward moving development cycle So what should I say "Monsieur Le Cook"? Keep the good work going it will lead to success. Having become a paying member in the words of Edith Piaf may I say ..... non rien de rien ... je ne regrette rien. Vive La France.
FK (JED)
         

Get Started