- Screen name: Howard Ronald Brown
Howard Ronald Brown's Profile
7 Posts
11 Responses
0
Followers
Show:
- Expanded view
- List view
Private Message
- 03-Apr-2020 01:25 AM
- Forum: Using jQuery UI
I'm adding text to a textarea that has been modified using the jQuery.UI resizable plug-in, after which I resize the textarea's hight by setting it to the textarea's scrollHeight, but since the parent div, added by the resizable plug-in has a fixed size, the textarea gets cut-off when the textarea height is now taller than the parent div's height.
I tried to fix this by assigning 'auto' to the div's height, but something is preventing my assignment. I also tried 'auto !imporant', but this didn't work, either.
How can I change the parent div's height to automatically expand to its contents?
This is what I tried:
$( function() {
$textarea.resizable();
$textarea.parent().css( 'height', 'auto' );
} );
Thank you.
- 27-Apr-2017 08:04 AM
- Forum: Developing jQuery UI
I know that there are other posts on this subject that seemed to indicate that this functionality wasn't necessary, but I have a "use-case" which demonstrates the need to be able to programmatically change a slider's value property and control whether or not the change event is triggered.My form has a single value range slider that has two buttons before slider and two buttons after the slider, that control the position of the slider's handle, specifically:A 'jump slider's handle to the left end' button,A 'move the sliders's handle one position toward the slider's left end' button,A 'move the sliders's handle one position toward the slider's right end' button, andA 'jump slider's handle to the right end' button,These four buttons programmatically set the slider's value property and all need to call the change event.However, while handling the two 'move' buttons, if the slider's handle is already at the left/right end of the slider then the slider's value property is programmatically reset the slider's handle to the other end of the slider and these calls to $( '#slider' ).slider( 'value', value ) should not trigger the change event, otherwise an endless change triggering occurs as the handle jumps back and forth between the two ends of the slider.If this issue has been address somewhere else, please point me at that solution.For a future release of the jQuery-UI Range Slider, it would be nice if there were an optional trigger-enable argument, i.e., $( '#slider' ).slider( 'value', value, TRUE/FALSE ), that could be used to allow/prevent the change event to be triggered or not, with the default being TRUE to allow the change event to be triggered.- 14-Oct-2016 04:35 AM
- Forum: Using jQuery
I'm using CodeIgniter, if it makes any difference, to create a page with a calendar list of events. The calendar list consists of a title, and two tables: the first table shows fixed table headings for a second table that contains rows that can scrolled when there are more rows than will fit into the fixed length of the second table. Each of the rows in the second table has an id, which brings that row into view when the URL of the page ends with a hash and the row's id. Amazingly, this all works fine, even when the row would otherwise be hidden 'below' the lowest visible line in the second table.The problem is because the calendar list is actually broken into two parts, when the URL with a # and id ending is displayed, the page is scrolls to the top of the second table, hiding the calendar title and the headers in the fist table. There is enough space to show the title and both tables, so I want to scroll the page up to show the calendar title, headings, and the second table.I added some code to the bottom of the page, that tries to do this after a lengthy delay, but it doesn't seem to work. I used Chrome's Inspect feature and can see that the variables are being properly set, and that the code does run through the lines that should scroll to the calendar's title, but this doesn't happen. Also, I don't get any errors in the console.log.I'm using these statements:- var rowId = ( ( location.hash != '' ) ? location.hash : '' ); // get hash of URL w/ #.
- var $calendarRow = ( ( rowtId != '' ) ? $( rowId ) : null ); // Get element, if have Id
- var calendarTop = $( '#CalendarTitle' ).offset().top;
- if( rowId != '' )
- if( $calendarRow.length ) {
- // There is a # id and the 2nd table contains it.
- // Highlight the calendar's 2nd table row that has the rowId.
- $calendarRow.css( { 'border' : 'thin solid white' } ); // Not working!?!?!?!?!
- // Scroll the calendar title and headers into view after everything settles down.
- $( document ).delay( 8000 ).scrollTop( calendarTop ); // Not working either!?!?!?!?!
- }
- else
- location.href = '#calendarTitle'; // if there's a # id, but it doesn't exist, show title.
If this isn't the best cross-browser way to do this please let me know.When I tried this using the location.href, the page does jump to the calendar title, but then I loose the row in the table that is supposed to be seen.Finally, this same page can be shown without using the # and id, in which case I want the page to show from its top and not automatically scroll down to the calendar list of events.- 23-Jul-2016 01:54 AM
- Forum: Using jQuery UI
I'm running datepicker controls on several pages and I want to put as much of the datepicker management in one place/file as I can, so to this end I have created a wrapper for datepicker, that loads the datepicker library and contains several functions that patch datepicker features/functionality to work the way that I need. The wrapper file is loaded in each page using the normal <script src> tag, after the JQuery library is loaded. Inside the wrapper file the datepicker library is loaded using the JQuery getScript mechanism, as follows://// import the "jquery_ui_datepicker_1.12.0.js" script//$.getScript( 'jquery_ui_datepicker_1.12.0.js' ).done( function( script, textStatus ) {// successful load - run datepicker library initialization code here.// run date picker patching code here.} ).fail( function( jqxhr, settings, exception ) {alert( 'Triggered ajaxError handler.' );} );// define datepicker patching functions starting here.This allows me to do an include within an include, but in order for the datepicker to work in the same way as if it were loaded using the <script src> tag I need the getScript's call-back feature to call all of the functions and in-line code that would have been normally run using the <script src> tag.Anyone have an idea how I can do this, short of modifying the content of the datepicker library?One thought is: Would it be possible to either tell getScript to put the datepicker library it loads into a container that I provide or get the container that it creates? Either way knowing the container, I should be able to wrap the container that the datepicker is in with a function container and call the function. I don't know how to actually do any of this, but the concept doesn't should too difficult.Looking forward to your ideas and, hopefully, examples.Thanks,Howard Brown- Here is the JSFiddle that I created to show this issue:From what I understand, the beforeShow 'event' calls the function assigned to it before actually displaying the calendar part of the datepicker. So in that function I put an alert( 'hi' ); statement, but it never shows.The demo shows this in an always open inline datepicker calendar, but I've tried this in a 'regular' datepicker and text box field, too, and both ways fail to show the alert.I'm using the most current JQuery,UI datepicker and Chrome, running Windows 10.Thank you,Howard Brown
- 19-Jul-2016 02:41 PM
- Forum: Using jQuery UI
When I click the prev(ious) month link nothing happens. It shows normally and when I hover the mouse pointer over it, it shows the 'priv' tool tip. On the same form I have three other datepickers, who's prev(ious) month links work normally. I am using the latest JQuery UI datepicker in Chrome Version 51.0.2704.103 m on a Windows 10 system.The working datepickers all share the same options initialization setting, which the inline date picker does not. Here is the 'code' for the inline datepicker:<div id="calendarDiv"></div><script>$( '#calendarDiv' ).datepicker( {dateFormat: 'mm/dd/yy',currentText: 'Today',numberOfMonths: 3, // [ 2, 3 ]showCurrentAtPos: 1,gotoCurrent: true,changeMonth: true,changeYear: true,showButtonPanel: true,onSelect:function( dateText, inst ) {$( '#calendarDiv' ).datepicker( "option", 'currentText', 'Selected' );setDatePicker( 'calendarDiv', dateText );}} );</script><script>function setDatePickerDate( whichDatePicker, newDate ) {$( "#" + whichDatePicker ).datepicker( "setDate", newDate );}</script>Incidentally, in my inline datepicker's onSelect handler, when I tried using the inst parameter to change the currentText button's text, it didn't change the text, so I 'brute-forced' the change, as shown above. If the inst contains the datepicker object, why wouldn't the following work?inst.datepicker( "option", 'currentText', 'Selected' );Thank you,Howard Brown- I just downloaded the latest files needed to use the Datepicker from GitHub, and I've found two issues that may already been addressed here, but looking back two years though this form, I didn't see anything addressing these two issues and a question:1) When I first open a page containing a datepicker, if I press the enter key in the datepicker input field or type an incomplete date, say 1 or 12, into the datepicker's text box while the calendar is showing and then press enter key, the current date overwrites the value I typed into the field. This doesn't happen when I type in a valid, complete, date with either two or four digits in the year. It only happens the first time I do this. Returning to the field and entering an invalid date or partial date isn't again replaced by the current date, and the code that I've attached to the datepicker's change and blur events to highlight an invalid date and holds the focus in the field works. Replacing the empty value with the current date would be fine, but replacing the invalid date shouldn't never happen. This also happens in the datepicker demo.2) The defaultDate: +7 option shown in the API Documentation for Datepicker doesn't highlight a date in the calendar, as described. Note that for the first issue, I'm not using this feature. There isn't a demo on this option, so I can't say if this happens only on my page or not.I am running Chrome Version 51.0.2704.103 m on a Windows 10 system. Here is the datepicker initialization code that I'm using://// Set the initial options for each of the datepickers having the datepiker class.//$( function() {$( '.datepiker' ).datepicker( {appendText: ' <i>(mm/dd/yyyy)</i>',dateFormat: 'mm/dd/yy',showOn: "both",buttonImage: "images/calendar.gif",buttonImageOnly: true,buttonText: "Select date",autoSize: true,changeMonth: true,changeYear: true,constrainInput: true,showButtonPanel: true,closeText: "Close"} ).on( 'change', function() { // The code in these two events came from a solution found in this forum.//// Only allow null or dates with, one or two digits / one or two digits / two or four digits.//if( !this.value.match( /^(?:\d{1,2}\/\d{1,2}\/(?:\d{2}){1,2})?$/ ) ) {this.style = "background-color: yellow; color: red;";document.here = this; // Save the active datepicker to the global variable, here,setTimeout( document.here.focus(), 0 ); // which is used to trapped the focus here while the date // is invalid.}elsethis.style="background-color: white; color: black;";} ).on( 'blur', function() {$(this).trigger( 'change' );} )} );Here is the input field that I'm using for the datepicker:Date C: <input type="text" id="datepickerC" class="datepiker" />The question, how do I style the Today button to look like the Close button? Right now it looks inactive, even though it works when I click it.
- «Prev
- Next »
Moderate user : Howard Ronald Brown
© 2013 jQuery Foundation
Sponsored by and others.

