Saja
Saja

Reputation: 61

Remove space between 2 words to be as one word in javascript

i have this code : v is variable consist from 2 words , i want to replace space and make them as one word at the last line name ="" . `

 $.each(val, function (i, v) {
        if($target.find('[name="select_'+type+'['+v+']"]').length) {

            $target.find('[name="select_'+type+'['+v+']"]').show().prop('disabled',false);
        }else{
            $target.append('<input from-select class="form-control" placeholder="'+v+'"  name="select_'+type+''+weekNo+''+v.replace(" ")+'">');
        }
    })

});

` doen't give an error but doesn't give what i want

Upvotes: 0

Views: 59

Answers (1)

Jason Dilworth
Jason Dilworth

Reputation: 45

v.replace(" ", "")

That should work.

Upvotes: 1

Related Questions