Perhaps my last question (now deleted) was misunderstood so I’m reposting it with more clarity this time:
jQuery(UI):
$("#tabs").tabs({
select: function(event, ui) {
alert(ui.panel.id);
$('input[name=myinput], textarea[name=myinput]').attr('disabled', true);
$('input[name=myinput].' + ui.panel.id + ', textarea[name=myinput].' + ui.panel.id).removeAttr('disabled');
$('input[name=source]').val(ui.panel.id);
}
});
HTML:
<div id='tabs'>
<ul>
<li><a href="#direct">Direct input</a></li>
<li><a href="#files">File upload</a></li>
<li><a href="#uri">URI</a></li>
</ul>
<div id="direct">
<textarea name='myinput' class='direct'></textarea>
</div>
<div id="file">
<input type='file' name='myinput' class='file' />
</div>
<div id="uri">
<input type='text' name='myinput' class='uri' />
</div>
</div>
<input type='hidden' name='source' value='direct' />
<input type='submit' value='GO' />
I don’t quite understand what the jQuery is doing with the input. I want to use regular jQuery and avoid the “jQueryUI” tabs so its important that I understand what happening with the input to I can reproduce the same effect when I use regular jQuery.
Hope I’m making sense.
Thanks for your help!
When the
selectfunction is called:Find all
inputandtextareaelements namedmyinputand disable them.Find any
inputelements andtextareaelements with the namemyinputand the class that matches the value of theui.panel.idproperty and enable them.Find the
inputelement (or elements, but I bet there’s only one) with the namesourceand set its value to the value of theui.panel.idproperty.E.g.: Disable all of the
myinputinputandtextareaelements except the one matching theui.panel.idproperty according to its class, and set the value of theinputnamedsourceto that property, presumably to keep track of which inputs are enabled / which tab is showing.