18 Posts
mikikado
9 years ago
1
Topic

Hi there!


I have a question refering disable a SEBLOD™-Smple-Optionsfield (or basicly for any type of fields). In my case I have a simple-option-field which I want to disable ater user made a selection. How to do?


I tried yet:


$("#fieldid").disabled()
$("#fieldid").disabled = true
$("#fieldid").hidden = true
$("#fieldid").hidden()
$("#fieldid").prop('disabled', true)
$("#fieldid").attr('disabled', 'disabled')

But nothing happens.

I have those tryings in the Script (JS) area of the field like fellowing:

$('#fieldid').on('change', function (){

 // some Code here

$("#fieldid").disabled = true
});


 "#fieldid" is just a example. Not the real field-id I have on my page!

For answers thank you in advance.

regards
Michael

Get a VIP membership
572 Posts
_jrmo
9 years ago
0
Level 1

Hi Michael,

Firstly, I think jQuery runs in safe mode on Joomla.. So you can't use $ in front of your code without wrapping all your code in 

jQuery(function($){

..your code..

});

Or replace $ with jQuery each time.

BUT

Why can't you use conditional states for this? 

Fieldname is disabled when field name is changed?

Cheers,

James

Get a Book for SEBLOD