Click here to Skip to main content
15,306,032 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionHow to solve this in js Pin
Miraz Uddin17-Jan-22 18:57
MemberMiraz Uddin17-Jan-22 18:57 
AnswerRe: How to solve this in js Pin
Richard Deeming17-Jan-22 21:34
mveRichard Deeming17-Jan-22 21:34 
QuestionHow to solve this in js Pin
Miraz Uddin17-Jan-22 18:53
MemberMiraz Uddin17-Jan-22 18:53 
AnswerRe: How to solve this in js Pin
Richard Deeming17-Jan-22 21:34
mveRichard Deeming17-Jan-22 21:34 
GeneralString Pin
SHAFI CANVASS6-Jan-22 12:40
MemberSHAFI CANVASS6-Jan-22 12:40 
GeneralRe: String Pin
RedDk6-Jan-22 13:07
MemberRedDk6-Jan-22 13:07 
GeneralRe: String Pin
jhonaa11-Jan-22 21:24
Memberjhonaa11-Jan-22 21:24 
QuestionReplecing .data() jQuery with JavaScript Pin
Member 154605438-Dec-21 9:46
MemberMember 154605438-Dec-21 9:46 
I am trying to rewrite this jQuery code to Typescript.

TypeScript
export class EditIntSliderCustomElement {
    parentVM: any;
    @bindable
    label: string;

    editSlider: HTMLInputElement;
    readOnlySlider: HTMLInputElement;

    @bindable
    min : number;

    @bindable
    max :number;

    @bindable
    step: number = 1;

    @bindable({ defaultBindingMode: bindingMode.twoWay })
    value: number;

    @bindable
    editOnly: boolean = false;

    @bindable
    hideMinMax: boolean = false;

    valueChanged(newValue) {
        let editSlider = $(this.editSlider).data("ionRangeSlider");
        if (editSlider && editSlider.old_from != newValue){
            editSlider.update({ from: newValue });
        }

        let readOnlySlider = $(this.readOnlySlider).data("ionRangeSlider");
        if (readOnlySlider && readOnlySlider.old_from != newValue) {
            readOnlySlider.update({ from: newValue });
        }
    }

    constructor() {
    }

    bind(bindingContext, overrideContext) {
        this.parentVM = bindingContext;
    }

    userChanged(newVal: number){
        if (this.value != newVal) {
            this.value = newVal;
        }

    }

    attached() {
        $(this.editSlider).ionRangeSlider({
            min: this.min,
            max: this.max,
            from: this.value,
            step: this.step,
            hide_min_max: this.hideMinMax,
            onChange: (data) => {
                this.userChanged(data.from);
            }

        });

        $(this.readOnlySlider).ionRangeSlider({
            min: this.min,
            max: this.max,
            from: this.value,
            step: this.step,
            hide_min_max: this.hideMinMax,
            disable: true,
            onChange: (data) => {
                this.userChanged(data.from);
            }

        });
    }
}



HTML
<pre>	<div show.bind="editOnly || parentVM.editMode != 0" class="form-group">
		<label-for>
			<small>${label}</small>
		</label-for>
		<input ref="editSlider" value.two-way="value" type="text">
	</div>
	<div show.bind="!editOnly && parentVM.editMode == 0">
		<small>${label}</small>
		<input ref="readOnlySlider" value.two-way="value" type="text">
	</div>



modified 8-Dec-21 16:55pm.

AnswerRe: Replecing .data() jQuery with JavaScript Pin
Richard Deeming8-Dec-21 22:12
mveRichard Deeming8-Dec-21 22:12 
QuestionCan't figure out why I'm not able to access my projects array within my JSON object Pin
jkirkerx23-Nov-21 13:20
professionaljkirkerx23-Nov-21 13:20 
AnswerRe: Can't figure out why I'm not able to access my projects array within my JSON object Pin
Richard Deeming23-Nov-21 21:31
mveRichard Deeming23-Nov-21 21:31 
GeneralRe: Can't figure out why I'm not able to access my projects array within my JSON object Pin
jkirkerx24-Nov-21 9:24
professionaljkirkerx24-Nov-21 9:24 
GeneralRe: Can't figure out why I'm not able to access my projects array within my JSON object Pin
Richard Deeming24-Nov-21 21:33
mveRichard Deeming24-Nov-21 21:33 
GeneralRe: Can't figure out why I'm not able to access my projects array within my JSON object Pin
jkirkerx25-Nov-21 7:37
professionaljkirkerx25-Nov-21 7:37 
Questionwait for fetch to finish within a for each loop Pin
jkirkerx16-Nov-21 13:35
professionaljkirkerx16-Nov-21 13:35 
AnswerRe: wait for fetch to finish within a for each loop Pin
Richard Deeming16-Nov-21 22:49
mveRichard Deeming16-Nov-21 22:49 
GeneralRe: wait for fetch to finish within a for each loop Pin
jkirkerx17-Nov-21 5:52
professionaljkirkerx17-Nov-21 5:52 
QuestionRecommended Apps to learn java for student? Pin
kennymanda11-Nov-21 19:44
professionalkennymanda11-Nov-21 19:44 
AnswerRe: Recommended Apps to learn java for student? Pin
OriginalGriff11-Nov-21 19:45
mveOriginalGriff11-Nov-21 19:45 
GeneralMessage Closed Pin
16-Dec-21 11:25
Membercryptorobotics16-Dec-21 11:25 
AnswerRe: Recommended Apps to learn java for student? Pin
Richard MacCutchan11-Nov-21 21:04
mveRichard MacCutchan11-Nov-21 21:04 
AnswerRe: Recommended Apps to learn java for student? Pin
jhonaa28-Mar-22 0:10
Memberjhonaa28-Mar-22 0:10 
QuestionUploading image using JQuery AJAX Pin
Alex Dunlop10-Nov-21 18:56
MemberAlex Dunlop10-Nov-21 18:56 
AnswerRe: Uploading image using JQuery AJAX Pin
Richard Deeming10-Nov-21 21:44
mveRichard Deeming10-Nov-21 21:44 
GeneralRe: Uploading image using JQuery AJAX Pin
Alex Dunlop10-Nov-21 22:14
MemberAlex Dunlop10-Nov-21 22:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.