Category Archives: Javascript
Set html in all elements having same ids using Jquery
//sets html in all ids across the page $(’[id^="'+id+'"]‘).html();
Get values inside JavaScript object
//data is javascript object with unknown ids //This loop with fetch all index name as well as their values for (var i in data) { alert(’theStatus[\''+i+'\'] is ‘ + data[i]) }
Set value in radio using jquery
$(“input:radio[name='name'][value=1]“.attr(‘checked’, true);
Jquery autocomplete with multiple data
$("#Query").autocomplete({ source: [{ label: ‘My First Item’, value: ‘/items/1′ }, { label: ‘My Second Item’, value: ‘/items/2′}] ,focus: function (event, ui) { $(event.target).val(ui.item.label); return false; } ,select: function (event, ui) { $(event.target).val(ui.item.label); window.location = ui.item.value; return false; } });
using text instead of convencial submit button
If we want to submit form using text instead of convencial submit button then follow the article. We’ve have to use following javascript code on click event. document.formname.submit() For Example: <form action=’newsletter/index’ name=’newsletter’> <input type="text" name="email" class="smalltxt" /><br /> <a … Continue reading
Highlight current element using javascript
Adding dyamic current link style using javascript. It makes easy to view where we are in website. I’m talking about when you are at home and home looks different from others. How can one achieve that without even using server … Continue reading