Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x

jQuery

16K

Solutions

5K

Contributors

jQuery (Core) is a cross-browser JavaScript library that provides abstractions for common client-side tasks such as Document Object Model (DOM) traversal, DOM manipulation, event handling, animation and Ajax. jQuery also provides a platform to create plugins that extend jQuery's capabilities beyond those already provided by the library.

Share tech news, updates, or what's on your mind.

Sign up to Post

I have in table column named user_date, and I have jquery on frontend to get user status ADULT or YOUNG. When user pick the date, script automaticaly write ADULT or YOUNG, depending on his picked date and current date, = >18 or <18. Now I would, to get number of young users which for one month will be ADULT, and get that number like some alert.
0
Concerto's Cloud Advisory Services
LVL 5
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

I am using SharePoint 2013.  

I am using Handlebars to display my SharePoint list into a table, which works.  But when I try to turn it into a dataTable, it does not transform into a dataTable.  I was able to do it in jsFiddle and it works.  Can you see what I am doing wrong?  

siteAdmin.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Handlebar Js Template Starts Here --> 
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.10/handlebars.min.js"></script>   
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://understandsp.com/spdev/SiteAssets/siteAdmins.js"></script>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.10.16/css/jquery.dataTables.css" />
<script id="siteadmin-template" type="text/x-handlebars-template">
 
<table border=1 width="100%" id="example" class="display"> 
<thead>
	<tr>
		<th>Picture</th>
		<th>First Name</th>
		<th>Last Name</th>
		<th>Email</th>
		<th>Phone</th>
	</tr>

Open in new window

0
I have a row object that I need to use the row.find method
and essentially go through every control and add an attribute on the control...or maybe even change the ID....

I am thinking attribute would be easier.


I guesss I would need to to through each tr/td in this table and find the id..then make the change.

This row object only has one tr....and only 6 td....each td only has one control  
label,  selectlist,selectlist, decimal input, button, button
0
Please help with my JQuery click logic.
currently I can only hide the mobile menu when I click the menu button. I want it to hide when we click on any menu item or anywhere outside the menu as well. What I cannot figure out is how to hide the main menu in mobile mode but not desktop mode and not breaking the sub-menu function.
Code below is in 3 parts first JQuery, then CSS then HTML

(function($) { // Begin jQuery
  $(function() { // DOM ready
    // If a link has a dropdown, add sub menu toggle.
    $('nav ul li a:not(:only-child)').click(function(e) {
      $(this).siblings('.nav-dropdown').toggle();
      // Close one dropdown when selecting another
      $('.nav-dropdown').not($(this).siblings()).hide();
      e.stopPropagation();
    });
    // Clicking away from dropdown will remove the dropdown class
    $('html').click(function() {
      $('.nav-dropdown').hide();
    });
    // Toggle open and close nav styles on click
    $('#nav-toggle').click(function() {
      $('nav ul').slideToggle();
    });
    // Hamburger to X toggle
    $('#nav-toggle').on('click', function() {
      this.classList.toggle('active');
    });
  }); // end DOM ready
})(jQuery);
body {
  margin: 0;
}

nav {
  float: right;
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav ul li {
  float: left;
  position: relative;
}

nav ul li a {
  display: block;
  padding: 0 20px;
  line-height: 70px;
  background: #262626;
  color: #ffffff;
  text-decoration: none;
}

nav ul li

Open in new window

0
I've been trying to get this ng-idle example working and got help yesterday from Leakim and Leonidas here  The answer helped but I have an issue now....


You can see it here http://147.75.0.124:88/

1. I first put the ng-idle on the front page as an example and that works. You see that it pops up.
    I did it by changing module.js and I have config with  run
          I also change loginController and added the popup code to index.cshtml

That worked but I want it inside the site itself so I did this  Please login with this admin@admin.test /Password321$

2. Changed "mainController.js" and added
 
 angular
        .module('lawApp', ['ngIdle', 'ui.bootstrap'])
        .controller('mainCntrl', mainController)
    .config(function(IdleProvider, KeepaliveProvider) {
        IdleProvider.idle(5);
        IdleProvider.timeout(5);
        KeepaliveProvider.interval(10);
    }).run(['Idle', function (Idle) {
            Idle.watch();
        }]);
  

Open in new window


3. Added the ng-idle code to mainController.js

4. Added the popup code to the razor code

The idle popup displays but look at console and now the other controllers are broken. "feedController" is not defined anymore. Click on "Forms" and FormController is not defined anymore either.

Things I tried:

I added 'ngIdle' to feedController but didn't work
Changed the order of the controllers I call but then mainController throws an error

I know adding .module('lawApp', ['ngIdle', 'ui.bootstrap'])  to mainController is making the other controllers not get initialized. I've read about it on a link Julian Hanson sent me once. I fixed them a while back and now running into it again because I added ng-idle.

Please don't suggest rewriting this in Angular 2
0
I have an html view...which has a template....
Note the use of display none.  
This template is used to inject a row into my datatable.

The problem with this is ....later on I have javascript that needs to find this control on the page...and it cannot because
Both template and the row added are rendered in html...

I need some way of appending an ID value to the controls when the row is added to the datatable...

Please help.


Here is template on my view:

<table id="new-row-template" style="display:none">
        <tbody>
            <tr>
                <td>
                    <label></label> 
                </td> 
                <td>
                   @Html.DropDownList("ddlRole", new SelectList(ViewBag.DDLRoles, "Value", "Text"), "")
                </td>
                <td>
                    @Html.DropDownList("selectdesignate", new List<SelectListItem>
                    {
                        new SelectListItem{ Text="", Value = ""  },
                        new SelectListItem{ Text="Primary", Value = "Primary" },
                        new SelectListItem{ Text="Secondary", Value = "Secondary" },
                     })                 
                </td>
                <td> 
                   @Html.TextBox("txtAllocation", new { @class = "form-control", @type = "number" })         
                </td>
                <td>
                    <button type="button" id="btnInsertContactEntity" class="btn btn-primary btn-xs 

Open in new window

0
I have a view...that build a few controls...and has two buttons..with JS events..that need to pass the values from the view in the  javascript function calls..

Please help.


Here is the section of the view where the controls are defined mostly.  My insert call for example here need to pass the contactid..which will be on a hiddenfield passed into the page from another page when this page is rendered.
The other values the user will select.  One is a dropdownlist populated from my controller/model.
The other is a dropdown with static values.
ANd finally the last column is just a decimal value input on screen.
There is also a client value passed fro mthe user selection of an autocomplete dropdown...not seen in this view.  Those values all need to go in my insert ...which is just an ajax call back to a controller method from javascript.

 <table id="new-row-template" style="display:none">
        <tbody>
            <tr>
                <td>
                    <label></label> 
                </td> 
                <td>
                   @Html.DropDownList("DropDownListID", new SelectList(ViewBag.DDLRoles, "Value", "Text"), "--- Please Choose an Item! ---")
                </td>
                <td>
                    <select id="selectdesignate" name="selectdesignate" class="form-control">
                        <option value="1"></option>
                        <option value="2">Primary</option>
                        <option 

Open in new window

0
Hi Experts:

I have a index.html file. I have an autocomplete function written in jQuery script. It appears an old design now. I want to port this design and implementation to a new design executed in angularJS.

The properties of my design is as soon as you click in Flying From and Flying to Box it will reset itself. As you type characters it will show matched destination.

For the new solution I want few popular destination as default choice on top. Or as soon as you click in the input box it should give you those options in the dropdown list of options.

Then the matched options as characters are printed. Code with few examples would be great help. In AngularJS apparently it can be very simply done. These input boxes can never be empty.

Look forward to your responses.

Best Regards

Sunnybrad

Open in new window

index.html
0
Hi,

I have the following <div> on my page URL: http://www.headstudios.com.au/book/wpwa_question/why-do-the-assignemtns-have-an-underscore/

<div class="my-rating" comment_id="59" curr_star=3>

This is done for every comment and I have jQuery that activates a 5 star rating system which can be found here:
https://github.com/nashio/star-rating-svg/blob/master/demo/index.html (it's basically where you can select a rating with jQuery from 5 stars)

Anyway the following jQuery code activates the stars:
<script type="text/javascript">
  window.onload = function() { 
  jQuery( document ).ready(function() {
    jQuery(".my-rating").starRating({
totalStars: 5,
  emptyColor: 'lightgray',
  hoverColor: 'salmon',
  activeColor: 'cornflowerblue',
  initialRating: jQuery(this).attr('curr_star'),
  strokeWidth: 0,
  useGradient: false,
  callback: function(currentRating, $el){
      //alert('comment ID is: ' +  + currentRating);
      
      jQuery.post( "http://www.headstudios.com.au/book/wp-content/plugins/wpwa-questions/update-star.php", { comment_id: $el[0].getAttribute('comment_id'), rating: currentRating } );
      
      //alert("The comment of 

Open in new window

..

You will see I have the following code:
  initialRating: jQuery(this).attr('curr_star'),

Open in new window


However this does not work because no initial stars are shown - when there should be 3 initial stars shown (since the 'curr_star' attribute is 3. Does anyone know what I am doing wrong? I would like to have the number in the 'curr_star' attribute be passed to the 'initialRating'.

Any ideas?
0
I have a web form on this page that's using jQuery based form field validation:

https://www.evergladesholidaypark.com/ehp-landingpage-markup/

Here's a link to the JS file that contains the validation script(s):

https://www.evergladesholidaypark.com/ehp-landingpage-markup/js/jquery.main.js

On the form .. I have the following DIV which is currently hidden by default:

<div class="error-message">            
You have either left one or more of the required fields in the form blank, or filled them out incorrectly.  Please apply the necessary corrections before re-submitting then form.            
</div>

Open in new window


Right now .. if you just click on the submit button without filling in any of the fields, .. the .error-message DIV is displayed for about 3 seconds, and then fades out.  I'm doing that using this code snippet which starts at about line number 305 in the JS file:

if (success != true) {          
  $(".error-message").show().delay(3000).fadeOut( "slow");          
}

Open in new window


The problem, however, is that I've placed this code inside the "checkSuccess" handler --- which is also being fired whenever an "onChange" event is triggered by any of the form fields.  This is obviously resulting in undesired effect .. where the error message repeatedly gets displayed adn then fades out, ... making the page grow and then shrink repeatedly.

What I'd like to do is change the script so that the .error-message DIV is only displayed when the following …
0
Independent Software Vendors: We Want Your Opinion
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

I have a div tag that is heing opened in modal with a button click
<a onclick="ShowFilterPopUp()" role="button" id="add_staff">Filters</a>

Open in new window


I am running some code on a second button click (In the modal window)

It reloads a grid
That reload closes the window

When I add an export to File as part of the process
The file does export but the modal does not close.

I tried calling a second code from server side but the modal window still does not close.

        LoadWithdrawals()
        If chkACH.Checked = True Then
            ExportACH() - exports but modal window does not close
            ScriptManager.RegisterStartupScript(Me, [GetType](), "blah", "ShowFilterPopUpHide();", True)
        End If

Open in new window



        function ShowFilterPopUp() {
            $('#modalFilters').modal('show');
        }

        function ShowFilterPopUpHide() {
            $('#modalFilters').modal('hide');
        }

Open in new window

0
I'm curious about how I might emulate what's currently going on with the Zillow homepage, .. where clicking on the different tabs both changes the background image, and also changes the appearance and behavior of the search form.

https://www.zillow.com/

I'd like to try to implement something similar on a WordPress site, most likely using JQuery (though I'm not averse to using vanilla JavaScript). Does anyone here have any tips or some "quick start" code examples they could share with me?

By the way  .. it's not necessary that I change the page url when I click on the different tabs.  I'm just looking to modify the DOM.

Thanks,
- Yvan
0
Hi,
I have a datatables table I am using to allow a person to resort the row order of the slides (see attached as example). In my mysql table I am using an additional column to set the row order of each row.
So essentially in mysql I have
id - primary auto increment
SlideOrder - I am using for the sequence
SlideTitle
and a couple created/modified datetime etc.

 
table example
When the user drops a row into place the code I'm using is below to send to server ( I start getting sketchy here on in):

oTable.on( 'row-reorder', function ( e, diff, edit ) 
{
var result;
var sendloop = [];
 		
	for ( var i=0, ien=diff.length ; i<ien ; i++ )
	{
		var rowData = oTable.row( diff[i].node ).data();
		result = ''+diff[i].newData+','+diff[i].oldData+'';
		sendloop.push(result);
	}
        	
	var jsonString = JSON.stringify(sendloop);
   
$.ajax({
        type: "GET",
        url: "/dealboxx/ohs/admin/sort",
        data: {data : jsonString}, 
        cache: false
    });
    });

Open in new window


The result of which sends an ajax request and the data variable (when I drag row 1 below row 4 for example):
data["1,2","2,3","3,4","4,1"]

Had I dragged row 2 below row 3 initially I'd be sending:
data["2,3","3,2"]

Had I dragged row 3 in front of row 1:
data["1,3","2,1","3,2"]

When the data gets to my server (my wrong code) does this:
public function sortCourse(Request $request)
    {
	$obj = json_decode($request->input('data'), true);
	
	foreach($obj as $row)
	{
     
		$insertArray = explode(",",$row);
		
		$slidechange = DB::table('ohs_courses_content')
			->select('id')
			->where('SlideOrder',$insertArray[1])
		    ->first();
		
    
	DB::table('ohs_courses_content')
            ->where('id', $slidechange->id)
            ->update(['SlideOrder' => $insertArray[0]]);
 	 	}
	
    
    }

Open in new window


Depending on what I initially dragged it may work (if I'm dragging down or up). Couple drags into it and its a mess.

So my logic etc is no doubt totally wrong.

any help would be very much appreciated as always.
tj
0
Hi EE.

How can one get a control value like on a textbox get it value and set the button id to that value from textbox and for dropdown get the selected item value and set that value to a button id when clicking that button in php or html?
0
I am trying to create a select list ...that basically just creates a user entry for my user to select options to be inserted into the database.

I have this in my controller...which Is not complete  Here roles is a list of value and label.....What am I missing here..and how would you then use this to display on view....to I need something in my view model as well?

       private IEnumerable<SelectListItem> GetRoles()
        {
            IContactEntityEditService contactEntityEditService = DependencyResolver.Current.GetService<IContactEntityEditService>();
            List<string> roles = contactEntityEditService.GetContactLinkedEntitiesRoles();
           
            roles.Select(x => new SelectListItem
                                {
                                    Value = x.value,
                                    Text = x.label
                                });

            return new SelectList(roles, "Value", "Text");
        }

Open in new window

0
Would someone please tell me how to extract the street address, city, state, and postal code from within this HTML div using javascript into 4 separate variables?

<div class="address">
123. Broadway
<br>
New York, NY  10009
</div>

var streetAddress = "";
var city = "";
etc, etc.

Thanks in advance for any help
0
Hello, I am trying to populate a select box using the below. Onclick of the link, the selectbox should populate with more values based on toggleval and the text should toggle.  It works fine on the first click, but the toggleval does not change on the next click. Any idea what is wrong with below.

Jquery:

function toggleme(toggleval){
	var o=$("#selectbox"),el=$("#toggleval");
        var selectIDs=(o.val()||[]).join();  
       
        o.empty().append('<option value="-1" disabled="disabled"><i>Loading...</i></option>');
        if(toggleval){toggleval = 1;}
        else
        {toggleval = 0;}
        $.ajax('cfcs/new.cfc?method=testcfc',{
            method: 'POST',
            data: {selectbox:selectIDs,toggleval:toggleval},
            success: function (retData) {
                o.empty().append(retData);
                $("#toggletext").html(toggleval?"hide":"show");
            }
        });
	}

Coldfusion in side a form:
<cfargument name="toggleval" default="false" />
<input type="hidden" name="toggleval" id="toggleval" value="#arguments.toggleval#" />
(<a href="javascript:void(0);" 
                onclick="Toggleme(<cfif arguments.toggleval>0<cfelse>1</cfif>)">
               <span id="toggletext"><cfif arguments.toggleval>hide<cfelse>show</cfif></span> Data</a>)</p>

<select class="form-control" name="selectbox" id="selectbox" >
                        #getdata(arguments.selectbox,toggleval)#
</select>

Open in new window

0
I have the following view......I am render a datatable to the page.
Afterwards I add a row to the grid.

the row does not even indicate that it is present until I hit the scroll bars.
It does howefver indicate that its their as it will say
49 of 49 entries (filtered from 50 total entries)

That number 50 is the one I add.

Here is my code...please help.

@section styles {
@Styles.Render("~/theme/redmond/jQuery-ui-1.10.3.custom.min.css")
    <style type="text/css">
        div.clear {
            clear: both;
        }

        documentType div.documentType-item input {
            position: absolute;
            left: 0;
            top: 0;
            visibility: hidden;
        }


        .rbutton {
            width: 20px !important;
            padding-left: 50px;
        }

        .centerText {
            text-align: center;
            vertical-align: middle;
            line-height: 7px;
        }

        .ui-autocomplete-custom {
            background: #87ceeb;
            z-index: 2;
        }

      
    </style>
    }

<script type="text/javascript" src="/Scripts/App/GenericGrid.js"></script>
<script type="text/javascript" src="/Scripts/App/ContactEntityEdit.js"></script>

@Html.Hidden("hdnContactId", String.Empty)
@Html.Hidden("hdnClientId", String.Empty)

<input type="hidden" id="hSiteCode" />
<input type="hidden" id="hSelectedSiteCodes" />
<input type="hidden" id="hGridName" />
<input type="hidden" id="hGridId" />
<input type="hidden" 

Open in new window

0
Hi,

Very Sorry for my silly question, I need to take seminar related  best recent IT technologies now . Please give some idea to choose recent IT technologies currently. And also that seminar topics useful for others.

Better topic related php  ,JS , Jquery, Angular JS etc.
0
Free Tool: SSL Checker
LVL 11
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

I'm trying to get the bot to continuously scan the page for any instances for the word "Follow" (But also checking that it is not "Following") and then click on all of these instances but with a set delay between each click. Is there any way to do this?
0
ttip.docxHi All:

I had a really simple question. How do you combine options and tooltip to have this effect as you see in modern travel portal. I have included a document displaying a above mentioned effect. A small example would be really helpful. I guess it is a combination of option and tooltip.

Look forward to your responses.

Best Regards,

Sunnybrad
0
I'm making a chrome extension, and basically id like to be able to pass it a certain word - like "Dog" and then it will click on every instance of "Dog" on the page. It should have a small time limit between each click. How would I do this? Whenever I've attempted this before I haven't been able to get it to work.

Edit: It’s for a bot to follow people on social medias
0
Hi

I have web form wherein there are more then 25 records of the data [records are of name & date ],  there checkbox against each record, now what I would like to do is whatever number of records they are selecting, I would like to submit number of pairs using ajax in given url.

Below is the code: My concern is that if they select 25 records from I want to put 25 pairs of username and date field to ajax url:

SubmitAll is being called from processdata button as aforesaid.

function submitAll(){
            $('.usrChkBx:checkbox:checked').each(function(){
                  var $dtP = $(this).parent().next();
                  var date = $dtP.find('input').val();
                  var name = $dtP.next().text();
                  //var urldata='';
                  //urldata=urldata+ "&Date=" +date+ "&Name="+name
                  //alert(urldata);
                  
            });
            
      }
alert(urldata);
      $(document).ready(function() {
            $('#example').DataTable();
             $('.date').datepicker({format: "dd/mm/yyyy"});
             
             $(".checkAll").click(function(){
                  $('input:checkbox').not(this).prop('checked', this.checked);
            });
      } );
0
Hello Experts,
Good Day!

Jquery Datatable, Pagination is not working as expected.

Please find attachments.

Please suggest.
ScreenHunter_10.jpg
ScreenHunter_11.jpg
0
Hello,

I saw how to adjust multi select lookup field width (solution here: https://www.experts-exchange.com/questions/27191951/How-to-adjust-width-of-SharePoint-Lookup-Field-Multi-Select.html), but maybe anyone can tell me how to adjust height?
0

jQuery

16K

Solutions

5K

Contributors

jQuery (Core) is a cross-browser JavaScript library that provides abstractions for common client-side tasks such as Document Object Model (DOM) traversal, DOM manipulation, event handling, animation and Ajax. jQuery also provides a platform to create plugins that extend jQuery's capabilities beyond those already provided by the library.

Related Topics