Coder Social home page Coder Social logo

get attribute this about star-rating-svg HOT 5 CLOSED

nashio avatar nashio commented on July 26, 2024
get attribute this

from star-rating-svg.

Comments (5)

greeninho avatar greeninho commented on July 26, 2024 1

hoangnamitc try this:
js
$(".my-rating").starRating({ starSize: 15, callback: function(currentRating, $el) { value = $($el).data('init'); } })

from star-rating-svg.

nashio avatar nashio commented on July 26, 2024

Do you want to read it from a DB?, how are you rendering your pages?
You have several options depending on what you're most familiar with.
You can server render the value in a JS variable and use it as a setting,
or you can also wait until your server call is done loading and then initialize the plugin
If you still need help let me know more details about your setup

from star-rating-svg.

hoangnamitc avatar hoangnamitc commented on July 26, 2024

I want read data of attribute initial plugin.
eg:
<div class="my-rating" data-init="3" data-readonly="true"></div>

how to me can get attribute data: init, readonly for parameters of plugin ? tks

from star-rating-svg.

hoangnamitc avatar hoangnamitc commented on July 26, 2024

@greeninho Thanks you answer, but function callback run when you click rating, I want get data from attribute of element for do parameter for starRating();
i'm can not do it.

from star-rating-svg.

TheGeekyM avatar TheGeekyM commented on July 26, 2024

You can use this js file instead js file link

and in your code you should do like this:
<div class="my-rating" data-readonly="{{$order->rate ? true : false}}" data-rating="{{$order->rate}}" id="{{$order->id}}"></div>

from star-rating-svg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.