Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8084603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T17:50:54+00:00 2026-06-05T17:50:54+00:00

<ul class=slist single required id=list-fieldtype data-vt-name=list-fieldtype > <li style=float:none;><a class=sbox selected data-vt-value=type_text data-vt-selected=1>Text</a></li> <li

  • 0
<ul class="slist single required" id="list-fieldtype" data-vt-name="list-fieldtype" >
            <li style="float:none;"><a class="sbox selected" data-vt-value="type_text" data-vt-selected="1">Text</a></li>
            <li style="float:none;"><a class="sbox" data-vt-value="type_number" data-vt-selected="0" >Number</a></li>
            <li style="float:none;"><a class="sbox" data-vt-value="type_date" data-vt-selected="0" >Date</a></li>
            <li style="float:none;"><a class="sbox" data-vt-value="type_yesno" data-vt-selected="0" >Yes/No</a></li>
            <li style="float:none;"><a class="sbox" data-vt-value="type_multi" data-vt-selected="0" >Multiple Choice Answers</a></li>
        </ul>

var $selected = $('.selected');
var new_fieldtype= $("#list-fieldtype").find( $selected ).removeClass('selected'); //this works


var new_fieldtype= $("#list-fieldtype>li>a").find( $selected ).data('vt-selected','0'); // does not work
         $("#list-fieldtype").find( 'type_text' ).addClass('selected'); // does not work
         $("#list-fieldtype>a[data-vt-value=type_text]").addClass('selected'); // does not work 

How do i make the last three statements work ?? any ideas ?

thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T17:50:56+00:00Added an answer on June 5, 2026 at 5:50 pm

    .data() can only be used to get the value of data attributes, not set them. You have to use .attr() to set the value of attributes.

     $selected.attr('data-vt-selected', 0);
    

    If your data attibute key if data-vt-value, the key to pass to .data() is vtValue

     var value = $selected.data('vtSelected');
    

    For the last statement, the selector is wrong: the anchor is not a direct child of the UL !

    $('#list-fieldtype > a[data-vt-value=type_text]')
    // should be
    $('#list-fieldtype a[data-vt-value=type_text]')
    

    DEMO

    Note it is pointless to do $("#list-fieldtype").find( $selected ). $selected is already the element you want to work with, so use it directly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sure we've all done this before: <a id=232 rel=link_to_user name=user_details class=list hoverable clickable
Class A { string name; IList<A> minorList = new List<A>(); } IList<A> majorList =
I want to count all the select list where its value selected as 1.
I have an unordered list: <ul class=list_arrow2> <li> <span style=display: inline-block; width: 150px; font-weight:
I have four div with class name .s-list . When the user clicks on
I have a nested list like this: <ul class=list> <li class=list_item_type_1> <ul class=list> <li
i want to select a element with jQuery. <ul> <li><label><input type=checkbox class=checkbox>checkbox1</label></li> <ul class=list>
The following code raises a runtime error: #include <iostream> #include <iterator> #include <ext/slist> class
Given the following mapping <class name=com.domain.Season table=cm.pub.jsn_mstr> <id name=seasonCode column=season_code length=1/> <property name=name type=string
I have a class that implements a linked list. The class has a find()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.